I have a terraform file set to create a list of S3 buckets, and I was assigning acl to each bucket the old way:
resource "aws_s3_bucket" "this" {
count = length(var.s3_bucket_names)
bucket = var.s3_bucket_names[count.index]
acl = var.acl
tags = var.tags
}
However, I want to know how to do it using aws_s3_bucket_acl
but I can't reference the bucket because it is a tuple and not a string. I've tried a lot of things but I've got nothing so far.
This is what I want to do:
resource "aws_s3_bucket_acl" "this_acl" {
bucket = HERE I DON'T KNOW HOW TO REFERENCE A TUPLE OR LIST
acl = var.acl
}
What should I do to reference a tuple since aws_s3_bucket.this.*.id
doesn't work with a tuple/list?
Thank you in advance.