Re:I made a mistake with Terraform and Azure made it worse
by arlk on Friday July 09, 2021 @12:42PM
(#27785608)
From what I experienced, per-environment branches is a bad practice that eventually will be a big burden to deal with especially when environments don't match. Actually the concept of "staging" in infrastructure is different than it in code, which is the usual source of confusion.
The best strategy is to have a repository for your modules only so you can specify the version[0] you want to use, and separate environments by folders.
[0]: https://www.terraform.io/docs/language/modules/sources.html#...
Re:I made a mistake with Terraform and Azure made it worse
by yashap on Saturday July 10, 2021 @01:30AM
(#27791348)
Yeah, we just had a single feature branch, which we would merge into the single master branch. We’d simply apply it to staging first, make sure nothing terrible happened, then apply to master. All those steps I listed above happened on the same branch, same PR.
- plan against staging
- get a PR approval
- apply against staging
- plan against prod
- apply against prod
- merge
Being forced to plan (and get someone up review said plan) before applying makes it far, far less likely you’ll do the level of damage described in this blog post.