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

add terraform_workspace_remote rule #738

Merged

Conversation

bendrucker
Copy link
Member

@bendrucker bendrucker commented May 6, 2020

This PR adds a rule that warns against the use of terraform.workspace interpolations when the user has a "remote" backend configured. This backend is used with Terraform Cloud and most TF Cloud users want to execute Terraform remotely. In these circumstances, terraform.workspace will always evaluate to "default". More here:

https://www.terraform.io/docs/backends/types/remote.html#workspaces

While you can use the remote backend as a state store and execute Terraform runs locally, this is of limited use and anyone using Terraform Cloud will likely want to move away from terraform.workspace for all of their configuration.

If terraform.workspace does not evaluate to the expected value, Terraform configuration may break or TF may plan unexpected changes.

@bendrucker bendrucker force-pushed the remote-terraform-workspace branch from 39ac2d9 to eec531b Compare May 6, 2020 04:23
@bendrucker bendrucker requested a review from wata727 May 11, 2020 06:14
@bendrucker
Copy link
Member Author

Updated this to use lang/addrs and WalkExpressions, super concise now!

Copy link
Member

@wata727 wata727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@wata727 wata727 merged commit a5c6898 into terraform-linters:master May 11, 2020
@bendrucker bendrucker deleted the remote-terraform-workspace branch May 11, 2020 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants