aws-samples/aws2tf

aws_s3_bucket_object_lock_configuration days and years have conflict

fanyanjie-pacvue opened this issue · 1 comments

If bucket enabled Object Lock, code will error:

Error: Conflicting configuration arguments

  with aws_s3_bucket_object_lock_configuration.b-<my-bucket>,
  on aws_s3_bucket_object_lock_configuration__b-<my-bucket>.tf line 9, in resource "aws_s3_bucket_object_lock_configuration" "b-<my-bucket>":
   9:       days  = 15

"rule.0.default_retention.0.days": conflicts with
rule.0.default_retention.0.years

Error: Conflicting configuration arguments

  with aws_s3_bucket_object_lock_configuration.b-<my-bucket>,
  on aws_s3_bucket_object_lock_configuration__b-<my-bucket>.tf line 11, in resource "aws_s3_bucket_object_lock_configuration" "b-<my-bucket>":
  11:       years = 0

"rule.0.default_retention.0.years": conflicts with
rule.0.default_retention.0.days

Validation after fix failed - exiting

The terrform file is:

##START,aws_s3_bucket_object_lock_configuration
resource "aws_s3_bucket_object_lock_configuration" "b-<my-bucket>" {
  bucket                = aws_s3_bucket.b-<my-bucket>.bucket
  expected_bucket_owner = null
  object_lock_enabled   = "Enabled"
  token                 = null # sensitive
  rule {
    default_retention {
      days  = 15
      mode  = "GOVERNANCE"
      years = 0
    }
  }
}

committed change that should fix this one.