dshimizu/blog

アルファ版

Terraform の Docker イメージを使ってワンライナーで実行する

環境変数をセットするのが面倒なので以下で1発で実行できるけど長いのが微妙。 profile や terraform コマンドのオプションなどは実行環境に応じて使い分ける。

% docker run -i --rm -v $PWD:/work -w /work -e AWS_ACCESS_KEY_ID=$(aws --profile terraform configure get aws_access_key_id) -e AWS_SECRET_ACCESS_KEY=$(aws --profile terraform configure get aws_secret_access_key) hashicorp/terraform plan -var-file=terraform.tfvars