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

(WIP) Allow undeclared vars #20748

Closed
wants to merge 1 commit into from

Conversation

Stretch96
Copy link

This adds the flag -allow-undeclared-vars which skips the parsing of
variables, which would otherwise generate an Error/Warning when a -var
is passed to apply/plan without being defined in a variable block

Without flag:

$ terraform plan -var foo=bar
Error: Value for undeclared variable

A variable named "foo" was assigned on the command line, but the root module
does not declare a variable of that name. To use this value, add a "variable"
block to the configuration.

With flag:

$ terraform apply -var foo=bar -allow-undeclared-vars

Refreshing Terraform state in-memory prior to plan...
...

* hashicorp#19424

This adds the flag `-allow-undeclared-vars` which skips the parsing of
variables, which would otherwise generate an Error/Warning when a `-var`
is passed to `apply`/`plan` without being defined in a variable block

Without flag:
```
$ terraform plan -var foo=bar
Error: Value for undeclared variable

A variable named "foo" was assigned on the command line, but the root module
does not declare a variable of that name. To use this value, add a "variable"
block to the configuration.
```

With flag:
```
$ terraform apply -var foo=bar -allow-undeclared-vars

Refreshing Terraform state in-memory prior to plan...
...
```
@hashicorp-cla
Copy link

hashicorp-cla commented Mar 19, 2019

CLA assistant check
All committers have signed the CLA.

@ghost
Copy link

ghost commented Sep 13, 2019

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 Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants