Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Environment Configuration command has changed #20

Open
pau1ie opened this issue Sep 2, 2022 · 0 comments
Open

Multiple Environment Configuration command has changed #20

pau1ie opened this issue Sep 2, 2022 · 0 comments

Comments

@pau1ie
Copy link

pau1ie commented Sep 2, 2022

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

  1. Clone this repo
  2. cd advanced-terraform-course/03_05-06_multi_environment/environments/0_development
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant