-
Notifications
You must be signed in to change notification settings - Fork 349
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
(Feature) Support terraform.workspace variable #181
(Feature) Support terraform.workspace variable #181
Conversation
Currently this just blindly sets Ideally this would actually set it's value from the |
Thanks for your contribution!
I guess it will behave similarly to |
Ah yes, I'll add that to the PR 👍 |
* Using ${terraform.workspace} currently causes `tflint` to fail: `unknown variable accessed: terraform.workspace in terraform.tf` * Resolves terraform-linters#177
39b20d6
to
d0d20e6
Compare
@wata727 That's added to the PR now 👍 |
@@ -25,6 +25,10 @@ func NewEvaluator(templates map[string]*hclast.File, schema []*schema.Template, | |||
Type: hilast.TypeString, | |||
Value: c.TerraformEnv, | |||
} | |||
varMap["terraform.workspace"] = hilast.Variable{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test case for ${terraform.workspace}
syntax :)
Example:
https://github.com/wata727/tflint/blob/3cf4a7eff3d7869da768ae3e51d8699d77c4c1df/evaluator/evaluator_test.go#L267-L295
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep sure, I'll add that in soon 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for review 👍
e4bf19c
to
2ee8232
Compare
👍 |
tflint
to fail:unknown variable accessed: terraform.workspace in terraform.tf