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

atlantis.yaml - Pass environment variables to extra_arguments #146

Closed
mechastorm opened this issue Sep 11, 2017 · 3 comments
Closed

atlantis.yaml - Pass environment variables to extra_arguments #146

mechastorm opened this issue Sep 11, 2017 · 3 comments

Comments

@mechastorm
Copy link

Repro

atlantis.yml

---
extra_arguments:
  - command_name: init
    arguments:
    - '-backend-config=env/${ENVIRONMENT}.backend.tfvars'

where ENVIRONMENT is the env set in atlantis plan environment

Expected Result

When I comment on the PR to do atlantis plan my-environment, it should run `terraform init -backend-config=env/my-environment.backend.tfvars

Actual Result

I get an error report from Atlantis stating

exit status 1: running "terraform init -no-color -backend-config=env/${ENVIRONMENT}.backend.tfvars" in "/home/shih.liong/.atlantis/repos/RCA-techops/atlantis-test-allinone/1/sandbox-us-west-2/terraform": 
invalid value "env/${ENVIRONMENT}.backend.tfvars" for flag -backend-config: Error reading env/${ENVIRONMENT}.backend.tfvars: open env/${ENVIRONMENT}.backend.tfvars: no such file or directory
Usage: terraform init [options] [DIR]
...

Description

I am trying to add additional arguments to the init stage of Terraform.

In our setup, we actually have a custom backend configs per environment. As such we need to initialize Terraform with our custom backend config file each time.

Without this, we cannot correctly start up the Terraform setup on each repo per environment.

@anubhavmishra
Copy link
Collaborator

@mechastorm Thanks for opening up this issue. We currently only support the environment variables in pre_plan, pre_apply, post_plan and post_apply steps, not in the extra arguments for commands for terraform. This should be an easy fix. Will let you know when we have a fix ready for this.

@anubhavmishra
Copy link
Collaborator

Cool, I have confirmed this behaviour. Will have a fix out soon.

@lkysow
Copy link
Collaborator

lkysow commented Nov 16, 2017

This was released in 0.1.3.

malnick pushed a commit to BlueOwlDev/atlantis that referenced this issue Jun 21, 2018
Disable code coverage GitHub statuses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants