Re:I made a mistake with Terraform and Azure made it worse
by aurantia on Friday July 09, 2021 @03:59AM
(#27781432)
> workspaces are specifically _not_ intended to be used as environment replacements.
From Terraform's "An Overview of Our Recommended Workflow"[1]:
"The best approach is to use one workspace for each environment of a given infrastructure component. Or in other words, Terraform configurations * environments = workspaces."
So 1 workspace != 1 environment but workspaces are indeed intended to handle multiple environments.I've personally struggled with managing multiple environments using Terraform so I'm interested in what the best practices are.
[1]: https://www.terraform.io/docs/cloud/guides/recommended-pract...
Re:I made a mistake with Terraform and Azure made it worse
by charsi on Friday July 09, 2021 @03:18AM
(#27781217)
Can you elaborate on why terraform workspaces are not intended to be used for environments? I use it exactly for this use case. Same terraform config deploying to production and staging, each maintaining its own state in a separate workspace.
To solve his problem, after switching to the data source type from resource he needed to manually run `terraform state rm` to get rid of the resource from the state.