Sitemap
The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Member-only story

šŸ”„An Intro to Bootstrapping AWS 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.

Photo from Skeeze@Pixabay

When you start rolling this out, you run into an immediate catch22 — you need an S3 bucket for TF state, and a DynamoDB for state locking to run terraform, but you need to run terraform in order to build these resources.

The best method I’ve thought of to get around this problem I’m calling ā€œpivotingā€. The basic order is:

  1. Run terraform from your local machine, and build the S3 bucket, DyanmoDB table, and any other bootstrap items you need.
  2. Tell terraform to use the s3 bucket and DyanmoDB table, and push your local .tfstate to the remote storage.
  3. 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 AWS account bootstrapped into your CI/CD before you can say ā€œterraform…

--

--

The Startup
The Startup

Published in The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +772K followers.

Kyler Middleton
Kyler Middleton

Written by Kyler Middleton

DevNetSecOps, DevRel, cloud security chick. I will teach you, it’s unavoidable. She/Her šŸ³ļøā€šŸŒˆšŸ³ļøā€šŸŒˆ, INFJ-A, support the EFF!

Responses (2)