Skip to content

Commit

Permalink
Merge pull request #11522 from theophilechevalier/add-source-hash-to-…
Browse files Browse the repository at this point in the history
…bucket-object

r/aws_s3_bucket_object: Add source_hash attribute
  • Loading branch information
YakDriver authored Jul 13, 2021
2 parents 4e50674 + efc078e commit 4e69d48
Show file tree
Hide file tree
Showing 4 changed files with 283 additions and 206 deletions.
3 changes: 3 additions & 0 deletions .changelog/11522.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_s3_bucket_object: Add `source_hash` argument to compliment `etag`'s encryption limitations
```
12 changes: 12 additions & 0 deletions aws/resource_aws_s3_bucket_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ func resourceAwsS3BucketObject() *schema.Resource {
Optional: true,
ValidateFunc: validation.IsRFC3339Time,
},

"source_hash": {
Type: schema.TypeString,
Optional: true,
},
},
}
}
Expand Down Expand Up @@ -564,6 +569,12 @@ func resourceAwsS3BucketObjectCustomizeDiff(_ context.Context, d *schema.Resourc
if hasS3BucketObjectContentChanges(d) {
return d.SetNewComputed("version_id")
}

if d.HasChange("source_hash") {
d.SetNewComputed("version_id")
d.SetNewComputed("etag")
}

return nil
}

Expand All @@ -582,6 +593,7 @@ func hasS3BucketObjectContentChanges(d resourceDiffer) bool {
"metadata",
"server_side_encryption",
"source",
"source_hash",
"storage_class",
"website_redirect",
} {
Expand Down
Loading

0 comments on commit 4e69d48

Please sign in to comment.