advanced-terraform-2823489
advanced-terraform-2823489 copied to clipboard
Multiple Environment Configuration command has changed
Issue Overview
Terraform has changed since the course was written such that the terraform init command described in section 03_05-06_multi_environment no longer works.
Describe your environment
Following the course exactly
Steps to Reproduce
- Clone this repo
cd advanced-terraform-course/03_05-06_multi_environment/environments/0_development- terraform init ../../manifests
Expected Behavior
Terraform init completes
Current Behavior
Error:
Too many command line arguments. Did you mean to use -chdir?
Possible Solution
Run the following command instead for the init
TF_DATA_DIR="$PWD/.terraform" terraform -chdir=../../manifests/ init
The variables still need to be read from the current directory during plan and (presumably) apply, so we need to do something like the following:
TF_DATA_DIR="$PWD/.terraform" terraform -chdir=../../manifests/ plan \
-var-file="$PWD/development.auto.tfvars" -out=s1.tfplan
This is still not quite the same as suggested as it leaves the .terraform.lock.hcl file in the manifests directory. I don't know enough to know whether this is a problem that needs to be fixed.
See the terraform release notes for more information.