Terraform tips: How to create multiple AWS s3 buckets with a single resource config

Image for post
Image for post
Mine. VSCode my 4k laptop :)

Intro

1. Setting up your Provider and variable

Image for post
Image for post
provider reference build

2. Create a single variable for the “s3_bucket_name”

Image for post
Image for post
Variable with all the bucket names you need

3. Create a single resource for “aws_s3_bucket”

Image for post
Image for post
single aws_s3_bucket resource tag

The Complete Code

The complete code

Thank you!!

Christian ~ Technical Account Manager at Google with a passion for GCP, AWS, Terraform & Laravel ~ 🔗paulkamau.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store