One of the biggest pains with terraform is that it's not totally 12-factor compliant (III. Config). That is, terraform doesn't consume environment variables for all settings & parameters. As a result, many of us use wrappers like terragrunt
to invoke terraform
.
Have you ever wanted to set the backend config using strictly environment variables?
Well, as it turns out this is possible - just in an extremely roundabout way. For example, if we want to set the backend-config bucket using an environment variable, we can do the following:
export TF_CLI_ARGS_init="-backend-config=bucket=my-bucket"