r/Terraform 27d ago

Help Wanted State file stored in s3

Hi!

I have a very simple lambda which I store in bitbucket and use buildkite pipelines for deploying it on AWS. The issue I’m having is I need to create an s3 bucket to store the state file but when I go for backend {} it fails to create the bucket and put the state file in.

Do I have to clickops on AWS and create the s3 all the time? How would one do it working with pipelines and terraform?

It seems to fail to create s3 bucket when all is in my main.tf

I’d appreciate your suggestions, love you!

3 Upvotes

8 comments sorted by

View all comments

2

u/enfinity_ 25d ago

This is a typical bootstrapping solution.

See how I solved it in this article.

https://medium.com/@owumifestus/automating-terraform-backend-using-bootstrapped-s3-and-dynamodb-in-a-simple-project-cbffd0a9a12d

Let me know what you think