Member-only story
š„Bootstrapping Azure Cloud to Your Terraform CI/CD
This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!
Pairing Terraform with a CI/CD like Azure DevOps, Terraform Cloud, or GitHub Actions can be incredibly empowering. Your team can work on code simultaneously, check it into a central repo, and once code is approved it can be pushed out by your CI/CD and turned into resources in the cloud.
When you start rolling this out, you run into an immediate catch22 ā you need a storage container to store the remote state in order to run terraform, but you need to run terraform in order to build these resources.
The best method Iāve found to get around this problem Iām calling āpivotingā. The basic order is:
- Run terraform from your local machine, and build the required remote resources.
- Tell terraform to use the remote state storage, then push your local .tfstate to the remote storage.
- Upload your terraform to the CI/CD, where it can access its state file and start building other cool things.
Letās walk through the steps, and youāll have an Azure account bootstrapped into yourā¦