Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_s3_bucket_object: Add source_hash attribute #11522

Merged

Conversation

theophilechevalier
Copy link
Contributor

@theophilechevalier theophilechevalier commented Jan 8, 2020

Add source_hash to resource_aws_s3_bucket_object.
Allows one to trigger resource update based on local changes instead of etag. Especially useful when etag cannot be used (e.g. with kms_key_id or server_side_encryption = "aws:kms").

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #6668
Relates #14900
Relates #9575
Relates #5033

Release note for CHANGELOG:

resource/aws_s3_bucket_object: Add source_hash attribute

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSS3BucketObject'        
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSS3BucketObject -timeout 120m
=== RUN   TestAccAWSS3BucketObject_noNameNoKey
=== PAUSE TestAccAWSS3BucketObject_noNameNoKey
=== RUN   TestAccAWSS3BucketObject_empty
=== PAUSE TestAccAWSS3BucketObject_empty
=== RUN   TestAccAWSS3BucketObject_source
=== PAUSE TestAccAWSS3BucketObject_source
=== RUN   TestAccAWSS3BucketObject_content
=== PAUSE TestAccAWSS3BucketObject_content
=== RUN   TestAccAWSS3BucketObject_etagEncryption
=== PAUSE TestAccAWSS3BucketObject_etagEncryption
=== RUN   TestAccAWSS3BucketObject_contentBase64
=== PAUSE TestAccAWSS3BucketObject_contentBase64
=== RUN   TestAccAWSS3BucketObject_SourceHashTrigger
=== PAUSE TestAccAWSS3BucketObject_SourceHashTrigger
=== RUN   TestAccAWSS3BucketObject_withContentCharacteristics
=== PAUSE TestAccAWSS3BucketObject_withContentCharacteristics
=== RUN   TestAccAWSS3BucketObject_NonVersioned
=== PAUSE TestAccAWSS3BucketObject_NonVersioned
=== RUN   TestAccAWSS3BucketObject_updates
=== PAUSE TestAccAWSS3BucketObject_updates
=== RUN   TestAccAWSS3BucketObject_updateSameFile
=== PAUSE TestAccAWSS3BucketObject_updateSameFile
=== RUN   TestAccAWSS3BucketObject_updatesWithVersioning
=== PAUSE TestAccAWSS3BucketObject_updatesWithVersioning
=== RUN   TestAccAWSS3BucketObject_kms
=== PAUSE TestAccAWSS3BucketObject_kms
=== RUN   TestAccAWSS3BucketObject_sse
=== PAUSE TestAccAWSS3BucketObject_sse
=== RUN   TestAccAWSS3BucketObject_acl
=== PAUSE TestAccAWSS3BucketObject_acl
=== RUN   TestAccAWSS3BucketObject_metadata
=== PAUSE TestAccAWSS3BucketObject_metadata
=== RUN   TestAccAWSS3BucketObject_storageClass
=== PAUSE TestAccAWSS3BucketObject_storageClass
=== RUN   TestAccAWSS3BucketObject_tags
=== PAUSE TestAccAWSS3BucketObject_tags
=== RUN   TestAccAWSS3BucketObject_tagsLeadingSlash
=== PAUSE TestAccAWSS3BucketObject_tagsLeadingSlash
=== RUN   TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithNone
=== PAUSE TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithNone
=== RUN   TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithOn
=== PAUSE TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithOn
=== RUN   TestAccAWSS3BucketObject_ObjectLockRetentionStartWithNone
=== PAUSE TestAccAWSS3BucketObject_ObjectLockRetentionStartWithNone
=== RUN   TestAccAWSS3BucketObject_ObjectLockRetentionStartWithSet
=== PAUSE TestAccAWSS3BucketObject_ObjectLockRetentionStartWithSet
=== CONT  TestAccAWSS3BucketObject_noNameNoKey
=== CONT  TestAccAWSS3BucketObject_kms
=== CONT  TestAccAWSS3BucketObject_ObjectLockRetentionStartWithSet
=== CONT  TestAccAWSS3BucketObject_metadata
=== CONT  TestAccAWSS3BucketObject_tags
=== CONT  TestAccAWSS3BucketObject_tagsLeadingSlash
=== CONT  TestAccAWSS3BucketObject_acl
=== CONT  TestAccAWSS3BucketObject_storageClass
=== CONT  TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithOn
=== CONT  TestAccAWSS3BucketObject_sse
=== CONT  TestAccAWSS3BucketObject_SourceHashTrigger
=== CONT  TestAccAWSS3BucketObject_ObjectLockRetentionStartWithNone
=== CONT  TestAccAWSS3BucketObject_content
=== CONT  TestAccAWSS3BucketObject_updatesWithVersioning
=== CONT  TestAccAWSS3BucketObject_contentBase64
=== CONT  TestAccAWSS3BucketObject_updateSameFile
=== CONT  TestAccAWSS3BucketObject_updates
=== CONT  TestAccAWSS3BucketObject_NonVersioned
=== CONT  TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithNone
=== CONT  TestAccAWSS3BucketObject_etagEncryption
--- PASS: TestAccAWSS3BucketObject_noNameNoKey (4.02s)
=== CONT  TestAccAWSS3BucketObject_withContentCharacteristics
--- SKIP: TestAccAWSS3BucketObject_NonVersioned (4.09s)
    provider_test.go:1192: skipping tests; TF_ACC_ASSUME_ROLE_ARN must be set
=== CONT  TestAccAWSS3BucketObject_source
--- PASS: TestAccAWSS3BucketObject_sse (58.27s)
=== CONT  TestAccAWSS3BucketObject_empty
--- PASS: TestAccAWSS3BucketObject_content (58.58s)
--- PASS: TestAccAWSS3BucketObject_contentBase64 (59.11s)
--- PASS: TestAccAWSS3BucketObject_source (55.06s)
--- PASS: TestAccAWSS3BucketObject_etagEncryption (59.21s)
--- PASS: TestAccAWSS3BucketObject_withContentCharacteristics (56.28s)
--- PASS: TestAccAWSS3BucketObject_kms (85.09s)
--- PASS: TestAccAWSS3BucketObject_SourceHashTrigger (96.60s)
--- PASS: TestAccAWSS3BucketObject_updateSameFile (98.13s)
--- PASS: TestAccAWSS3BucketObject_updates (98.15s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithOn (99.04s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioning (99.69s)
--- PASS: TestAccAWSS3BucketObject_empty (55.46s)
--- PASS: TestAccAWSS3BucketObject_metadata (132.65s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockRetentionStartWithNone (137.95s)
--- PASS: TestAccAWSS3BucketObject_acl (140.12s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithNone (141.01s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockRetentionStartWithSet (177.68s)
--- PASS: TestAccAWSS3BucketObject_tags (178.98s)
--- PASS: TestAccAWSS3BucketObject_tagsLeadingSlash (180.29s)
--- PASS: TestAccAWSS3BucketObject_storageClass (222.33s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       223.615s

@theophilechevalier theophilechevalier requested a review from a team January 8, 2020 10:28
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/M Managed by automation to categorize the size of a PR. service/s3 Issues and PRs that pertain to the s3 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Jan 8, 2020
@jacobeatsspam
Copy link

jacobeatsspam commented Feb 11, 2020

@bflad could someone take a look at this?

Related to #5033

@frittentheke
Copy link

@jacobisaliveandwell awesome that you started implementing this!

I also opened an issue /suggestion about this a while ago: #6668

@jacobeatsspam
Copy link

@frittentheke all credit goes to @theophilechevalier, I just came here to complain. I want this feature and don't see what the hold up is.

@YakDriver Any hope?

@theophilechevalier
Copy link
Contributor Author

Seems that #9575 is related

@wernerb
Copy link
Contributor

wernerb commented Sep 1, 2020

This depends on #14900 to be there otherwise diffs will not ensure a new version_id is created.

@frittentheke
Copy link

This depends on #14900 to be there otherwise diffs will not ensure a new version_id is created.

@wernerb That PR is now merged. Would be great to get the source hashing in as well.

@jacobeatsspam
Copy link

@YakDriver @bflad Any chance you could look at this now?

Base automatically changed from master to main January 23, 2021 00:56
@emachnic
Copy link

emachnic commented Feb 8, 2021

Looks like there hasn't been any movement on this since November 23rd and it's definitely still an issue. What's the status? Is this going to be merged?

@frittentheke
Copy link

Looks like there hasn't been any movement on this since November 23rd and it's definitely still an issue. What's the status? Is this going to be merged?

I second this question.

@frittentheke
Copy link

@YakDriver @bflad you did review a few S3 related PRs lately. Is there any chance you could look at this one?

Allows one to store a hash in state to trigger resource
update.
@YakDriver YakDriver force-pushed the add-source-hash-to-bucket-object branch from 8b38606 to 26271f3 Compare July 13, 2021 01:35
@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Jul 13, 2021
@YakDriver YakDriver removed the needs-triage Waiting for first response or review from a maintainer. label Jul 13, 2021
@YakDriver YakDriver self-assigned this Jul 13, 2021
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 🎉

Output from acceptance tests (us-west-2):

--- PASS: TestAccAWSS3BucketObject_noNameNoKey (6.04s)
--- PASS: TestAccAWSS3BucketObject_sse (38.77s)
--- SKIP: TestAccAWSS3BucketObject_nonVersioned (0.00s)
--- PASS: TestAccAWSS3BucketObject_objectBucketKeyEnabled (44.98s)
--- PASS: TestAccAWSS3BucketObject_kms (48.06s)
--- PASS: TestAccAWSS3BucketObject_bucketBucketKeyEnabled (49.93s)
--- PASS: TestAccAWSS3BucketObject_defaultBucketSSE (50.05s)
--- PASS: TestAccAWSS3BucketObject_withContentCharacteristics (38.33s)
--- PASS: TestAccAWSS3BucketObject_objectLockLegalHoldStartWithOn (84.52s)
--- PASS: TestAccAWSS3BucketObject_sourceHashTrigger (87.43s)
--- PASS: TestAccAWSS3BucketObject_updates (88.05s)
--- PASS: TestAccAWSS3BucketObject_updateSameFile (82.06s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioning (88.51s)
--- PASS: TestAccAWSS3BucketObject_content (40.56s)
--- PASS: TestAccAWSS3BucketObject_contentBase64 (38.80s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioningViaAccessPoint (89.26s)
--- PASS: TestAccAWSS3BucketObject_ignoreTags (89.54s)
--- PASS: TestAccAWSS3BucketObject_metadata (101.47s)
--- PASS: TestAccAWSS3BucketObject_etagEncryption (32.49s)
--- PASS: TestAccAWSS3BucketObject_objectLockLegalHoldStartWithNone (110.24s)
--- PASS: TestAccAWSS3BucketObject_source (28.23s)
--- PASS: TestAccAWSS3BucketObject_acl (113.16s)
--- PASS: TestAccAWSS3BucketObject_empty (27.02s)
--- PASS: TestAccAWSS3BucketObject_tagsLeadingMultipleSlashes (133.42s)
--- PASS: TestAccAWSS3BucketObject_tagsLeadingSingleSlash (133.54s)
--- PASS: TestAccAWSS3BucketObject_tagsMultipleSlashes (133.66s)
--- PASS: TestAccAWSS3BucketObject_tags (133.67s)
--- PASS: TestAccAWSS3BucketObject_objectLockRetentionStartWithNone (84.53s)
--- PASS: TestAccAWSS3BucketObject_objectLockRetentionStartWithSet (101.83s)
--- PASS: TestAccAWSS3BucketObject_storageClass (149.09s)

Output from acceptance tests (GovCloud):

--- SKIP: TestAccAWSS3BucketObject_nonVersioned (1.15s)
--- PASS: TestAccAWSS3BucketObject_noNameNoKey (5.10s)
--- PASS: TestAccAWSS3BucketObject_withContentCharacteristics (41.39s)
--- PASS: TestAccAWSS3BucketObject_sse (41.13s)
--- PASS: TestAccAWSS3BucketObject_contentBase64 (42.46s)
--- PASS: TestAccAWSS3BucketObject_etagEncryption (42.65s)
--- PASS: TestAccAWSS3BucketObject_objectBucketKeyEnabled (43.13s)
--- PASS: TestAccAWSS3BucketObject_bucketBucketKeyEnabled (48.25s)
--- PASS: TestAccAWSS3BucketObject_defaultBucketSSE (48.36s)
--- PASS: TestAccAWSS3BucketObject_objectLockLegalHoldStartWithOn (76.94s)
--- PASS: TestAccAWSS3BucketObject_sourceHashTrigger (83.29s)
--- PASS: TestAccAWSS3BucketObject_source (45.08s)
--- PASS: TestAccAWSS3BucketObject_content (45.40s)
--- PASS: TestAccAWSS3BucketObject_empty (45.41s)
--- PASS: TestAccAWSS3BucketObject_kms (40.88s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioningViaAccessPoint (84.45s)
--- PASS: TestAccAWSS3BucketObject_ignoreTags (89.87s)
--- PASS: TestAccAWSS3BucketObject_metadata (116.27s)
--- PASS: TestAccAWSS3BucketObject_objectLockLegalHoldStartWithNone (117.07s)
--- PASS: TestAccAWSS3BucketObject_objectLockRetentionStartWithNone (117.26s)
--- PASS: TestAccAWSS3BucketObject_updateSameFile (74.28s)
--- PASS: TestAccAWSS3BucketObject_updates (71.20s)
--- PASS: TestAccAWSS3BucketObject_tagsLeadingSingleSlash (135.52s)
--- PASS: TestAccAWSS3BucketObject_objectLockRetentionStartWithSet (142.54s)
--- PASS: TestAccAWSS3BucketObject_tags (143.42s)
--- PASS: TestAccAWSS3BucketObject_tagsMultipleSlashes (143.50s)
--- PASS: TestAccAWSS3BucketObject_tagsLeadingMultipleSlashes (143.60s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioning (67.37s)
--- PASS: TestAccAWSS3BucketObject_acl (102.53s)
--- PASS: TestAccAWSS3BucketObject_storageClass (165.06s)

@YakDriver YakDriver added this to the v3.50.0 milestone Jul 13, 2021
@YakDriver YakDriver merged commit 4e69d48 into hashicorp:main Jul 13, 2021
@github-actions
Copy link

This functionality has been released in v3.50.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/s3 Issues and PRs that pertain to the s3 service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

r/aws_s3_bucket_object: Use own hash to track object changes (move away from the etag md5 value)
6 participants