Reputation: 2852
I am looking for suggestions on how I can toggle the replication_configuration
block on an aws_S3_bucket
resource.
I am trying to have the replication_configuration
block be applied only if my variable enable_crr
is set to true
in terraform.
The issue I face is that the block doesn't support enabled
or count
, so I'm hoping someone knows an alternative way of implementing this.
Does anyone have any suggestions?
Upvotes: 1
Views: 583
Reputation: 2852
So I found a way that works... I added some logic to do two things:
1) ${var.enable_replication} == true ? <my backup bucket> : <a placeholder bucket arn>}
2) I toggle the replication status between Enabled / Disabled
By doing this, if it's enabled it points to my backup bucket, and if its disabled it points to my placeholder bucket.
edit: if you're reading this, in version 0.12.x you can use dynamic
to do this.
Upvotes: 2