I'm new to Terraform and have come across the concept of bootstrapping a Terraform project. From what I gather, this involves setting up a local state and creating necessary resources before migrating to a managed state. I'm looking to develop a basic bootstrap project specifically for Terraform on AWS. Initially, I think an S3 bucket is essential for storing state, but I'm unsure what additional resources would be beneficial. Since I haven't worked much with modules yet, I'm curious if they can help me create a template for multiple AWS resources, especially since I have a few .NET projects that could share the same module. Any guidance would be greatly appreciated!
4 Answers
When setting up AWS bootstrapping, you'll definitely want an S3 bucket for state management. Adding DynamoDB is useful for state locking, but if you're running a newer version of Terraform (1.11 or later), you might not even need it anymore. You can handle some of this setup from the AWS console and then use import blocks to bring those resources into Terraform later on.
There’s a solid approach to not even using S3 for state storage—GitLab’s built-in Terraform state access via HTTP is a game changer. But if you do go with S3, you're right about the initial chicken-and-egg problem with configuring the first resources.
I've created a Makefile that boots up your AWS account's state management using S3 while integrating CI/CD pipelines with GitHub Actions. You can check out the full template in my GitHub repo; it's designed to help you set everything quickly without having to manually configure state or roles yourself. Here’s the link: [Makefile on GitHub](https://github.com/towardsthecloud/aws-terraform-starter-kit/blob/main/Makefile)
A minimal setup definitely just requires the S3 bucket for state. You can keep it simple if you're just starting out, but if you’re planning on expanding, setting up an admin role can help with initial resources like IAM permissions.

That's a good point! I guess S3 for state is pretty straightforward without complicating things with DynamoDB.