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

Resource Tagging Waiters for AWS Services with Eventual Consistency #15572

Closed
bflad opened this issue Oct 9, 2020 · 2 comments
Closed

Resource Tagging Waiters for AWS Services with Eventual Consistency #15572

bflad opened this issue Oct 9, 2020 · 2 comments
Labels
service/kms Issues and PRs that pertain to the kms service. service/s3control Issues and PRs that pertain to the s3control service. service/s3 Issues and PRs that pertain to the s3 service. service/sagemaker Issues and PRs that pertain to the sagemaker service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.

Comments

@bflad
Copy link
Contributor

bflad commented Oct 9, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

The typical flow of Terraform AWS Provider resources is Create -> Read and Update -> Read, where resource tagging (the tags argument) is changed in Create/Update and refreshed in Read to ensure the changes occurred as expected. Some AWS service APIs perform tagging updates with eventual consistency. Examples of our acceptance testing that highlights this issue:

=== CONT  TestAccAWSS3ControlBucket_Tags
    resource_aws_s3control_bucket_test.go:72: Step 1/4 error: Check failed: Check 2/3 error: aws_s3control_bucket.test: Attribute 'tags.%' expected "1", got "0"
--- FAIL: TestAccAWSS3ControlBucket_Tags (269.96s)

=== CONT  TestAccAWSSagemakerEndpointConfiguration_Tags
TestAccAWSSagemakerEndpointConfiguration_Tags: resource_aws_sagemaker_endpoint_configuration_test.go:171: Step 1/3 error: Check failed: Check 2/3 error: aws_sagemaker_endpoint_configuration.foo: Attribute 'tags.%' expected "1", got "0"
--- FAIL: TestAccAWSSagemakerEndpointConfiguration_Tags (62.64s)

=== CONT  TestAccAWSSagemakerModel_tags
TestAccAWSSagemakerModel_tags: resource_aws_sagemaker_model_test.go:93: Step 1/3 error: Check failed: Check 2/3 error: aws_sagemaker_model.foo: Attribute 'tags.%' expected "1", got "0"
--- FAIL: TestAccAWSSagemakerModel_tags (52.34s)

    external_key_test.go:368: Step 4/4 error: Check failed: Check 3/4 error: aws_kms_external_key.test: Attribute 'tags.%' expected "1", got "2"

These resources will either require not calling Read after Create/Update (not preferred) or introducing additional handling to retry the tag reading until it matches the expected state up to a hardcoded timeout (2 minutes seems reasonable). The caveat here is that the state refresh must account for provider-level ignored tags and in the future provider-level default tags.

Affected Resource(s)

  • UPDATE Dec. 1, 2021: This has been seen increasingly with all services.
  • aws_s3_bucket
  • aws_s3control_bucket
  • aws_sagemaker_endpoint_configuration
  • aws_sagemaker_model

References

@bflad bflad added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/s3 Issues and PRs that pertain to the s3 service. service/sagemaker Issues and PRs that pertain to the sagemaker service. technical-debt Addresses areas of the codebase that need refactoring or redesign. service/s3control Issues and PRs that pertain to the s3control service. labels Oct 9, 2020
@YakDriver YakDriver added the service/kms Issues and PRs that pertain to the kms service. label Dec 1, 2021
ewbankkit added a commit that referenced this issue Dec 23, 2022
).

Acceptance test output:

% make testacc TESTARGS='-run=TestAccS3ControlBucket_' PKG=s3control ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/s3control/... -v -count 1 -parallel 3  -run=TestAccS3ControlBucket_ -timeout 180m
=== RUN   TestAccS3ControlBucket_basic
=== PAUSE TestAccS3ControlBucket_basic
=== RUN   TestAccS3ControlBucket_disappears
=== PAUSE TestAccS3ControlBucket_disappears
=== RUN   TestAccS3ControlBucket_tags
    acctest.go:71: S3 Control Bucket resource tagging requires additional eventual consistency handling, see also: #15572
--- SKIP: TestAccS3ControlBucket_tags (0.00s)
=== CONT  TestAccS3ControlBucket_basic
=== CONT  TestAccS3ControlBucket_disappears
    acctest.go:1368: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucket_disappears (1.00s)
=== CONT  TestAccS3ControlBucket_basic
    acctest.go:1368: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucket_basic (1.07s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3control	6.289s
ewbankkit added a commit that referenced this issue Sep 11, 2023
% make testacc TESTARGS='-run=TestAccS3ControlBucketLifecycleConfiguration_\|TestAccS3ControlBucketPolicy_\|TestAccS3ControlBucket_' PKG=s3control ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/s3control/... -v -count 1 -parallel 3  -run=TestAccS3ControlBucketLifecycleConfiguration_\|TestAccS3ControlBucketPolicy_\|TestAccS3ControlBucket_ -timeout 180m
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_basic
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_basic
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_disappears
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_disappears
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_RuleAbortIncompleteMultipartUpload_daysAfterInitiation
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_RuleAbortIncompleteMultipartUpload_daysAfterInitiation
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_date
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_date
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_days
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_days
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_expiredObjectDeleteMarker
    acctest.go:85: S3 on Outposts does not error or save it in the API when receiving this parameter
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_expiredObjectDeleteMarker (0.00s)
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_prefix
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_prefix
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_tags
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_tags
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_Rule_id
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_Rule_id
=== RUN   TestAccS3ControlBucketLifecycleConfiguration_Rule_status
=== PAUSE TestAccS3ControlBucketLifecycleConfiguration_Rule_status
=== RUN   TestAccS3ControlBucketPolicy_basic
=== PAUSE TestAccS3ControlBucketPolicy_basic
=== RUN   TestAccS3ControlBucketPolicy_disappears
=== PAUSE TestAccS3ControlBucketPolicy_disappears
=== RUN   TestAccS3ControlBucketPolicy_policy
=== PAUSE TestAccS3ControlBucketPolicy_policy
=== RUN   TestAccS3ControlBucket_basic
=== PAUSE TestAccS3ControlBucket_basic
=== RUN   TestAccS3ControlBucket_disappears
=== PAUSE TestAccS3ControlBucket_disappears
=== RUN   TestAccS3ControlBucket_tags
    acctest.go:85: S3 Control Bucket resource tagging requires additional eventual consistency handling, see also: #15572
--- SKIP: TestAccS3ControlBucket_tags (0.00s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_basic
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_Rule_id
=== CONT  TestAccS3ControlBucketPolicy_policy
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketPolicy_policy (1.04s)
=== CONT  TestAccS3ControlBucketPolicy_disappears
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_Rule_id
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_Rule_id (1.06s)
=== CONT  TestAccS3ControlBucketPolicy_basic
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_basic
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_basic (1.14s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_Rule_status
=== NAME  TestAccS3ControlBucketPolicy_basic
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketPolicy_basic (0.19s)
=== CONT  TestAccS3ControlBucket_basic
=== NAME  TestAccS3ControlBucketPolicy_disappears
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketPolicy_disappears (0.22s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_days
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_Rule_status
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_Rule_status (0.20s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_tags
=== NAME  TestAccS3ControlBucket_basic
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucket_basic (0.22s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_prefix
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_days
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_days (0.21s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_RuleAbortIncompleteMultipartUpload_daysAfterInitiation
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_tags
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_tags (0.19s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_date
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_prefix
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_RuleFilter_prefix (0.19s)
=== CONT  TestAccS3ControlBucketLifecycleConfiguration_disappears
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_RuleAbortIncompleteMultipartUpload_daysAfterInitiation
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_RuleAbortIncompleteMultipartUpload_daysAfterInitiation (0.22s)
=== CONT  TestAccS3ControlBucket_disappears
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_date
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_RuleExpiration_date (0.21s)
=== NAME  TestAccS3ControlBucketLifecycleConfiguration_disappears
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucketLifecycleConfiguration_disappears (0.20s)
=== NAME  TestAccS3ControlBucket_disappears
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccS3ControlBucket_disappears (0.24s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/s3control	7.242s
Copy link

github-actions bot commented Jan 1, 2024

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jan 1, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2024
Copy link

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 have found a problem that seems similar to this, 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 Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/kms Issues and PRs that pertain to the kms service. service/s3control Issues and PRs that pertain to the s3control service. service/s3 Issues and PRs that pertain to the s3 service. service/sagemaker Issues and PRs that pertain to the sagemaker service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. technical-debt Addresses areas of the codebase that need refactoring or redesign. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

No branches or pull requests

2 participants