terraform-aws-s3-bucket icon indicating copy to clipboard operation
terraform-aws-s3-bucket copied to clipboard

fix: use for_each instead of count in aws_s3_bucket_logging

Open wadhah101 opened this issue 1 year ago • 2 comments

what

Replaced the count with a for_each inside aws_s3_bucket_logging.default

there's no point in the try since the type is clearly defined as list

why

When the bucket_name within logging attribute is dynamically defined, like in the case of referencing a bucket created by terraform for logging

  logging = [
    {
      bucket_name = module.logging_bucket.bucket_id
      prefix      = "data/"
    }
  ]

we get this error Screenshot 2024-02-05 at 12 50 30

For each can work better in this case and will solve the previous error

references

wadhah101 avatar Feb 05 '24 12:02 wadhah101

/terratest

Gowiem avatar Feb 05 '24 12:02 Gowiem

/terratest

hans-d avatar Mar 02 '24 17:03 hans-d

@hans-d done

wadhah101 avatar Mar 03 '24 19:03 wadhah101

/terratest

hans-d avatar Mar 03 '24 19:03 hans-d