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

Unknown variable errors in atlas on terraform push #1480

Closed
ocxo opened this issue Apr 10, 2015 · 6 comments
Closed

Unknown variable errors in atlas on terraform push #1480

ocxo opened this issue Apr 10, 2015 · 6 comments

Comments

@ocxo
Copy link

ocxo commented Apr 10, 2015

I've tried setting aws key vars set in terraform.tfvars, variables.local.tf but I get the following error after a terraform push -name foo/bar triggers a plan execution.

Plan execution has failed

The plan encountered an errored while executing 2 minutes ago. Plans do not modify real infrastructure, so this failure is safe. The error is shown below.

There are warnings and/or errors related to your configuration. Please
fix these before continuing.

Errors:

  * module root: 4 error(s) occurred:

* resource 'aws_instance.nat' config: unknown variable referenced: aws_key_name
* provider config 'aws': unknown variable referenced: aws_access_key
* provider config 'aws': unknown variable referenced: aws_secret_key
* resource 'aws_instance.bastion' config: unknown variable referenced: aws_key_name

I've also tried terraform push -name foo/bar -var "aws_secret_key=foo" and get the same error.

I'm running Terraform v0.4.1.

@ocxo
Copy link
Author

ocxo commented Apr 10, 2015

The vars are set on Atlas

@mitchellh
Copy link
Contributor

I clarified the error message, but you need to define the variables with `variable.

@ocxo
Copy link
Author

ocxo commented Apr 11, 2015

@mitchellh Thanks but I don't think this is resolved or I'm misunderstanding something key about Terraform/Atlas variables. The variables were defined in a variable block but the ones that were missing in Atlas were the vars I defined in variables.local.tf (and had them .gitignored since they are sensitive).

I found that by moving those sensitive vars to variables.tf, Atlas now picks them up. Is this a bug in Atlas? Terraform can handle variables.local.tf fine locally but fails with the same var config on Atlas.

According to Terraform's variable docs, I think this should have worked:

Note that the file can be named anything, since Terraform loads all files ending in .tf in a directory.

@mitchellh
Copy link
Contributor

@fromonesrc If it is ignored by git, it won't be uploaded with terraform push, You can use -vcs=false to upload all files.

sarahhodne pushed a commit to sarahhodne/terraform that referenced this issue Apr 14, 2015
@jayjhan8
Copy link

I'd recommend this bit represented in the docs. I followed the recommendation in ignoring my terraform.tfvars but I wasn't sure why my variables weren't being set in the run development in Atlas.

@ghost
Copy link

ghost commented May 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants