Cloud Resume Challenge Week 3— Infrastructure as Code with Terraform and CI/CD with GitHub Actions
Chunk 3 is complete — and this one pushed me the furthest outside my comfort zone. Infrastructure as Code, remote state management, and a fully automated CI/CD pipeline are all now in place. In this post I'm documenting exactly what I built, the decisions I made, and the bugs I hit along the way. What is Chunk 3 about? The goal is to stop clicking through the AWS Console and start defining…
Chunk 3 of the Cloud Resume Challenge focused on implementing Infrastructure as Code (IaC) using Terraform and setting up a CI/CD pipeline with GitHub Actions. The main goal was to move away from manually managing infrastructure in the AWS Console and automate the deployment process so that every push to the GitHub repository triggers a full deployment.
The tools used in this challenge were Terraform for defining AWS resources in code, GitHub Actions for automating the deployment pipeline, an S3 remote backend for storing Terraform state files, and a Dev Container for creating a reproducible development environment in GitHub Codespaces.
Terraform was chosen over AWS SAM because of its cloud-agnostic nature, industry demand, clean HCL language, and strong community support. The Dev Container setup ensured that all required tools (AWS CLI, Terraform, Python, and GitHub CLI) were automatically installed in the GitHub Codespaces environment.
The project structure consisted of a `terraform/` directory containing `main.tf`, `variables.tf`, `outputs.tf`, and `providers.tf` files. This structure allowed for defining AWS resources, input variables, output values, and provider configurations.
A critical aspect of the challenge was setting up the remote backend for Terraform state management. By storing the state file in S3, both local development and GitHub Actions CI/CD could share a consistent view of the infrastructure, avoiding resource conflict errors during pipeline runs.
Throughout the process, several bugs were encountered and resolved:
1. Resource conflicts on the first apply were fixed by importing existing resources into the Terraform state.
2. DynamoDB table item import was not supported by Terraform, so the problematic resource was removed from the main.tf file.
3. GitHub Actions initially had no access to the Terraform state file, leading to resource conflict errors. This was resolved by setting up the S3 remote backend as previously mentioned.
4. A string concatenation error in the outputs.tf file was fixed by using string interpolation instead of the + operator.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.