-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Correctly handle ignored tags for S3 Bucket and Object resources #12013
Conversation
@@ -236,6 +236,23 @@ func (tags KeyValueTags) UrlEncode() string { | |||
return values.Encode() | |||
} | |||
|
|||
func (tags KeyValueTags) String() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful for acceptance test logging.
I kept to the map[string]string
format.
40c5fb2
to
731d823
Compare
Fixed unit test failure (it worked on my machine 😄). |
Revisit once #13039 is merged. |
731d823
to
be4a73f
Compare
Now that #13039 has been merged and the functionality released I have added acceptance tests: With the changes
Without the changes$ git revert 4972052b9153e2f9eab78a5547869f2c642cb62a
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3BucketObject_ignoreTags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSS3BucketObject_ignoreTags -timeout 120m
=== RUN TestAccAWSS3BucketObject_ignoreTags
=== PAUSE TestAccAWSS3BucketObject_ignoreTags
=== CONT TestAccAWSS3BucketObject_ignoreTags
--- FAIL: TestAccAWSS3BucketObject_ignoreTags (56.66s)
testing.go:669: Step 1 error: Check failed: Check 7/7 error: Incorrect tags, want: map[Key1:AAA Key2:BBB Key3:CCC ignorekey1:ignorevalue1] got: map[Key1:AAA Key2:BBB Key3:CCC]
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 56.709s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3Bucket_ignoreTags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSS3Bucket_ignoreTags -timeout 120m
=== RUN TestAccAWSS3Bucket_ignoreTags
=== PAUSE TestAccAWSS3Bucket_ignoreTags
=== CONT TestAccAWSS3Bucket_ignoreTags
--- FAIL: TestAccAWSS3Bucket_ignoreTags (57.64s)
testing.go:669: Step 1 error: Check failed: Check 6/6 error: Incorrect tags, want: map[Key1:AAA Key2:BBB Key3:CCC ignorekey1:ignorevalue1] got: map[Key1:AAA Key2:BBB Key3:CCC]
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 57.677s
FAIL
GNUmakefile:26: recipe for target 'testacc' failed
make: *** [testacc] Error 1
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3Bucket_tagsWithSystemTags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSS3Bucket_tagsWithSystemTags -timeout 120m
=== RUN TestAccAWSS3Bucket_tagsWithSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithSystemTags
=== CONT TestAccAWSS3Bucket_tagsWithSystemTags
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (176.60s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 176.645s |
d2f7ac7
to
72f21dd
Compare
Rebased to resolve merge conflict. $ make testacc TEST=./aws TESTARGS='-run=TestAccAWSS3Bucket_tags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSS3Bucket_tags -timeout 120m
=== RUN TestAccAWSS3Bucket_tagsWithNoSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithNoSystemTags
=== RUN TestAccAWSS3Bucket_tagsWithSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithSystemTags
=== CONT TestAccAWSS3Bucket_tagsWithNoSystemTags
=== CONT TestAccAWSS3Bucket_tagsWithSystemTags
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (94.24s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (142.72s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 142.785s |
72f21dd
to
975b818
Compare
Rebased to remove merge conflicts. $ make testacc TEST=./aws TESTARGS='-run=TestAccAWSS3Bucket_tags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSS3Bucket_tags -timeout 120m
=== RUN TestAccAWSS3Bucket_tagsWithNoSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithNoSystemTags
=== RUN TestAccAWSS3Bucket_tagsWithSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithSystemTags
=== CONT TestAccAWSS3Bucket_tagsWithNoSystemTags
=== CONT TestAccAWSS3Bucket_tagsWithSystemTags
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (115.07s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (161.66s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 161.716s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3Bucket_ignoreTags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSS3Bucket_ignoreTags -timeout 120m
=== RUN TestAccAWSS3Bucket_ignoreTags
=== PAUSE TestAccAWSS3Bucket_ignoreTags
=== CONT TestAccAWSS3Bucket_ignoreTags
--- PASS: TestAccAWSS3Bucket_ignoreTags (51.52s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 51.555s
$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3BucketObject_ignoreTags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSS3BucketObject_ignoreTags -timeout 120m
=== RUN TestAccAWSS3BucketObject_ignoreTags
=== PAUSE TestAccAWSS3BucketObject_ignoreTags
=== CONT TestAccAWSS3BucketObject_ignoreTags
--- PASS: TestAccAWSS3BucketObject_ignoreTags (51.68s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 51.730s |
975b818
to
654e978
Compare
Rebased and resolved merge conflicts. $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSS3Bucket_tags\|TestAccAWSS3Bucket_ignoreTags\|TestAccAWSS3BucketObject_ignoreTags'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSS3Bucket_tags\|TestAccAWSS3Bucket_ignoreTags\|TestAccAWSS3BucketObject_ignoreTags -timeout 120m
=== RUN TestAccAWSS3BucketObject_ignoreTags
=== PAUSE TestAccAWSS3BucketObject_ignoreTags
=== RUN TestAccAWSS3Bucket_tagsWithNoSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithNoSystemTags
=== RUN TestAccAWSS3Bucket_tagsWithSystemTags
=== PAUSE TestAccAWSS3Bucket_tagsWithSystemTags
=== RUN TestAccAWSS3Bucket_ignoreTags
=== PAUSE TestAccAWSS3Bucket_ignoreTags
=== CONT TestAccAWSS3BucketObject_ignoreTags
=== CONT TestAccAWSS3Bucket_ignoreTags
=== CONT TestAccAWSS3Bucket_tagsWithSystemTags
=== CONT TestAccAWSS3Bucket_tagsWithNoSystemTags
2020/09/13 18:14:53 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
--- PASS: TestAccAWSS3BucketObject_ignoreTags (59.29s)
--- PASS: TestAccAWSS3Bucket_ignoreTags (59.29s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (119.79s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (156.90s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 156.965s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🚀
Output from acceptance testing (test failure unrelated):
--- FAIL: TestAccAWSS3Bucket_UpdateGrant (99.49s)
--- PASS: TestAccAWSS3Bucket_acceleration (136.41s)
--- PASS: TestAccAWSS3Bucket_AclToGrant (121.55s)
--- PASS: TestAccAWSS3Bucket_basic (73.90s)
--- PASS: TestAccAWSS3Bucket_Bucket_EmptyString (75.26s)
--- PASS: TestAccAWSS3Bucket_Cors_Delete (67.67s)
--- PASS: TestAccAWSS3Bucket_Cors_EmptyOrigin (77.63s)
--- PASS: TestAccAWSS3Bucket_Cors_Update (133.80s)
--- PASS: TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled (133.26s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed (74.95s)
--- PASS: TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical (75.65s)
--- PASS: TestAccAWSS3Bucket_forceDestroy (60.38s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes (59.19s)
--- PASS: TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled (56.94s)
--- PASS: TestAccAWSS3Bucket_generatedName (74.19s)
--- PASS: TestAccAWSS3Bucket_GrantToAcl (126.42s)
--- PASS: TestAccAWSS3Bucket_ignoreTags (119.94s)
--- PASS: TestAccAWSS3Bucket_LifecycleBasic (148.63s)
--- PASS: TestAccAWSS3Bucket_LifecycleExpireMarkerOnly (122.51s)
--- PASS: TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock (69.45s)
--- PASS: TestAccAWSS3Bucket_Logging (80.49s)
--- PASS: TestAccAWSS3Bucket_namePrefix (73.64s)
--- PASS: TestAccAWSS3Bucket_objectLock (88.55s)
--- PASS: TestAccAWSS3Bucket_Policy (185.71s)
--- PASS: TestAccAWSS3Bucket_Replication (202.83s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (153.18s)
--- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (151.18s)
--- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (55.63s)
--- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (168.76s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (92.59s)
--- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (117.59s)
--- PASS: TestAccAWSS3Bucket_RequestPayer (131.63s)
--- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (70.60s)
--- PASS: TestAccAWSS3Bucket_shouldFailNotFound (50.35s)
--- PASS: TestAccAWSS3Bucket_tagsWithNoSystemTags (241.90s)
--- PASS: TestAccAWSS3Bucket_tagsWithSystemTags (283.92s)
--- PASS: TestAccAWSS3Bucket_UpdateAcl (129.68s)
--- PASS: TestAccAWSS3Bucket_Versioning (162.00s)
--- PASS: TestAccAWSS3Bucket_Website_Simple (184.12s)
--- PASS: TestAccAWSS3Bucket_WebsiteRedirect (182.52s)
--- PASS: TestAccAWSS3Bucket_WebsiteRoutingRules (129.42s)
--- PASS: TestAccAWSS3BucketObject_acl (177.09s)
--- PASS: TestAccAWSS3BucketObject_content (63.54s)
--- PASS: TestAccAWSS3BucketObject_contentBase64 (67.40s)
--- PASS: TestAccAWSS3BucketObject_empty (64.61s)
--- PASS: TestAccAWSS3BucketObject_etagEncryption (63.45s)
--- PASS: TestAccAWSS3BucketObject_ignoreTags (121.67s)
--- PASS: TestAccAWSS3BucketObject_kms (67.13s)
--- PASS: TestAccAWSS3BucketObject_metadata (167.79s)
--- PASS: TestAccAWSS3BucketObject_noNameNoKey (13.59s)
--- PASS: TestAccAWSS3BucketObject_NonVersioned (63.83s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithNone (176.74s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithOn (122.59s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockRetentionStartWithNone (170.60s)
--- PASS: TestAccAWSS3BucketObject_ObjectLockRetentionStartWithSet (230.76s)
--- PASS: TestAccAWSS3BucketObject_source (60.64s)
--- PASS: TestAccAWSS3BucketObject_sse (65.88s)
--- PASS: TestAccAWSS3BucketObject_storageClass (286.04s)
--- PASS: TestAccAWSS3BucketObject_tags (225.84s)
--- PASS: TestAccAWSS3BucketObject_tagsLeadingSlash (230.76s)
--- PASS: TestAccAWSS3BucketObject_updates (118.53s)
--- PASS: TestAccAWSS3BucketObject_updateSameFile (117.90s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioning (121.17s)
--- PASS: TestAccAWSS3BucketObject_updatesWithVersioningViaAccessPoint (121.99s)
--- PASS: TestAccAWSS3BucketObject_withContentCharacteristics (66.25s)
This has been released in version 3.10.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 for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Relates #11964.
Relates #11916.
Relates #10689.
Relates #7342.
The
aws_s3_bucket_object
scenario was tested usingignore_tags
functionality and the following acceptance test case:That case fails without the change:
and passes after the change:
The
aws_s3_bucket
scenario can be verified with the existing acceptance test cases.Release note for CHANGELOG:
Output from acceptance testing: