Skip to content

Multiple Environment Configuration command has changed #20

@pau1ie

Description

@pau1ie

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions