Unable to set versioning to "Disabled"
tadejsv opened this issue · comments
This is a copy of #196, which was closed automatically. @antonbabenko
Same issue as in #61.
For some reason, this module prevents me from setting bucket versioning to "Disabled"
terraform-aws-s3-bucket/main.tf
Lines 137 to 138 in a2fb4a4
Even though that is a valid value for the versioning configuration, see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning#status
I agree this seems like unusual behavior to write into the module, but I see where @antonbabenko was coming from. It looks like if you simply do not provide a value for the versioning
variable, the aws_s3_bucket_versioning
resource will not be created. In that case, a brand new bucket will effectively be versioning=disabled.
As @bryantbiggs has mentioned, once you set a value (Enabled or Suspended), you can't go back to Disabled. So the current logic in this module attempts to avoid an invalid configuration: Create a bucket with versioning=Enabled, then change it to Disabled will cause an error on apply.
I agree with @jgard and I don't think that we can do anything about it in the module. This is mirroring the behavior of AWS API as described in the Terraform docs versioning_configuration
.
I'm going to lock this issue because it has been closed for 30 days