From 594a89bdf9b615f07d271581707257c7dcd5e75e Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Fri, 4 Feb 2022 14:21:09 -0500 Subject: [PATCH] set lifecycle_rule with nil if dne for bucket --- internal/service/s3/bucket.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index ab2a95e36cc..b72f4808cf8 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -263,7 +263,7 @@ func ResourceBucket() *schema.Resource { }, "lifecycle_rule": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, Deprecated: "Use the aws_s3_bucket_lifecycle_configuration resource instead", Elem: &schema.Resource{ @@ -1033,6 +1033,8 @@ func resourceBucketRead(d *schema.ResourceData, meta interface{}) error { if err := d.Set("lifecycle_rule", flattenBucketLifecycleRules(lifecycle.Rules)); err != nil { return fmt.Errorf("error setting lifecycle_rule: %s", err) } + } else { + d.Set("lifecycle_rule", nil) } // Read the bucket replication configuration if configured outside this resource