I'm curious about how people handle the "chicken and egg" problem when setting up their backend infrastructure on AWS. I've noticed that many opt for a bootstrap directory to deploy resources like S3 and DynamoDB tables. I'm getting used to this method, but I'm interested in hearing how others tackle this, especially since DynamoDB is becoming less popular for state locking. Any tips or best practices?
4 Answers
I prefer using Terraform the whole way through. I start by running it without a backend set up—this allows me to create the S3 bucket without needing DynamoDB. Once the bucket is created, I enable the remote backend again and push my local state file.
One effective way to approach this is to manually bootstrap just the bare essentials. By 'manually', I mean using a solid bootstrap script to set things up initially. Usually, this includes creating a Service Account and whatever's necessary for the functioning state backend. Once that's done, import these resources into Terraform for future management.
Honestly, I tend to keep it simple. I have a generic CloudFormation template that I leverage to set up the Terraform backend resources. It saves me time and effort.
I use a CloudFormation template that I deploy via the AWS CLI. This template just creates the necessary Terraform storage bucket, and I think there’s a flag in the CLI (might be --deploy) that handles everything idempotently, which makes the process pretty smooth.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically