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

Added -input=false flag to init, plan, and apply steps #276

Closed
wants to merge 8 commits into from
Closed

Added -input=false flag to init, plan, and apply steps #276

wants to merge 8 commits into from

Conversation

austinorth
Copy link

fixes #268

Motivation

Atlantis needs to fail quickly and gracefully when user input is not provided for variables that are lacking a value.

What I Did

  • Added the -input=false flag to init, plan and apply step runners. This flag is recommended by Hashicorp here.
  • Added that same flag to the corresponding test files.

Difference in Output

Before Flag Added

exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/<username>/.atlantis/repos/<repo> -var atlantis_user=austinorth" in "<directory>"
var.some_variable
  Enter a value: 
var.some_variable
  Enter a value: 
var.some_variable
  Enter a value: 
var.some_variable
  Enter a value: 

Error: Error asking for user input: missing required value for "some_variable"

After Flag Added

exit status 1: running "exit status 1: running "sh -c terraform plan -input=false -refresh -no-color -out /home/<username>/.atlantis/repos/<repo> -var atlantis_user=austinorth" in "<directory>"

Error: Required variable not set: some_variable

@lkysow
Copy link
Member

lkysow commented Sep 14, 2018

Thanks looks good! I'll figure out the test problems.

@austinorth
Copy link
Author

austinorth commented Sep 14, 2018

Thanks! I think I just figured it out. I didn't add the flag for the pre-Terraform 0.9 get command. Terraform doesn't have versioned docs, sadly, so I haven't yet been able to confirm if that flag exists in the earlier version.

@austinorth
Copy link
Author

austinorth commented Sep 14, 2018

Update:
I downloaded Terraform 8.8 and looked at the help entry for the get command and found there are only two supported flags:

Options:

  -update=false       If true, modules already downloaded will be checked
                      for updates and updated if necessary.

  -no-color           If specified, output won't contain any color.

So I'll go ahead and roll back my change, but the test file will have to be modified to accommodate it. I'll leave that to you if that's ok!

@lkysow
Copy link
Member

lkysow commented Sep 14, 2018

Yeah I'll do the tests

@lkysow lkysow mentioned this pull request Sep 14, 2018
@lkysow
Copy link
Member

lkysow commented Sep 14, 2018

Merged in #277 with fixed tests. Thanks so much Austin! I'll get this in the next release.

@lkysow lkysow closed this Sep 14, 2018
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

Successfully merging this pull request may close these issues.

atlantis running terraform should default to not accepting input
2 participants