We can create a resource based on count like
resource "aws_s3_bucket" "mybucket" {
count = var.enabled ? 1 : 0
...
That is ok but I need something more.
aws_s3_bucket
has two different options for the bucket name
bucket
or bucket_prefix
They are conflict with each other.
I would like to have a variable like create_bucket_with_static_name
If create_bucket_with_static_name true
then
set bucket = var.bucket_name
else
set bucket_prefix = var.bucket_prefix_value
Is this doable in a single aws_s3_bucket resource? or Do I have to create two different aws_s3_bucket resource
one for bucket and other for bucket_prefix set?