Terraform how to to create multiple S3 buckets in parallel due to resource dependency issues
I've been struggling with this for a few days now and could really use some help. I'm trying to create multiple S3 buckets in AWS using Terraform, but I'm working with issues with resource dependencies that are causing the apply stage to unexpected result. I have a situation where I want to create three S3 buckets simultaneously, but it seems that Terraform need to handle the dependencies correctly. Hereβs the relevant portion of my Terraform configuration: ```hcl resource "aws_s3_bucket" "bucket1" { bucket = "my-bucket-1" } resource "aws_s3_bucket" "bucket2" { bucket = "my-bucket-2" depends_on = [aws_s3_bucket.bucket1] } resource "aws_s3_bucket" "bucket3" { bucket = "my-bucket-3" depends_on = [aws_s3_bucket.bucket2] } ``` When I run `terraform apply`, I'm getting the following behavior message: ``` behavior: behavior creating S3 bucket my-bucket-2: BucketAlreadyExists: The specified bucket already exists status code: 409, request id: ABCD1234, host id: xyz12345 ``` I know that the behavior indicates a conflict with an existing S3 bucket, but I thought the `depends_on` attribute would ensure that buckets are created in sequence. I tried removing the `depends_on` attribute, hoping to allow Terraform to handle the dependencies automatically, but that led to different issues where Terraform tries to create buckets in parallel, resulting in the same conflict. I also checked to ensure that bucket names are unique across all AWS S3 buckets. Iβm using Terraform version 1.0.11. What can I do to ensure these buckets are created without running into these errors? Is there a better way to structure my resources to deal with this scenario? My development environment is macOS.