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

Mixing variable definition and specification is order specific #5144

Closed
darrensony opened this issue Feb 16, 2016 · 2 comments · Fixed by #8482
Closed

Mixing variable definition and specification is order specific #5144

darrensony opened this issue Feb 16, 2016 · 2 comments · Fixed by #8482
Assignees

Comments

@darrensony
Copy link

From: https://www.terraform.io/docs/configuration/load.html

The order of variables, resources, etc. defined within the configuration doesn't matter. Terraform configurations are declarative, so references to other resources and variables do not depend on the order they're defined.

However, it appears that a empty (forward) declaration that occurs after a value declaration unsets the value.

To wit, this works:

variable "test" {}
variable "test" { default = "5" }

But swap the order, and it queries for a value for "test":

variable "test" { default = "5" }
variable "test" {}

Expected Behaviour: A late forward declaration should be silently ignored if there is already a value set for that variable in the symbol table.

@mitchellh
Copy link
Contributor

The real validation here is that a variable should only be allowed to be defined once. Fixed in referenced PR.

@ghost
Copy link

ghost commented Apr 22, 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 Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants