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

fix: convert insight_type to set type to address element order issue in aws_cloudtrail #37591

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

acwwat
Copy link
Contributor

@acwwat acwwat commented May 20, 2024

Description

This PR is to convert the insight_selector argument type from List to Set for the aws_cloudtrail resource, so that it accounts for the unordered nature of this element in the AWS API response.

Note that in the acceptance case, TestAccCloudTrail_serial/Trail/migrateV0 is failing because the ID is set to the ARN and not the name. I am not sure if it's due to my development environment having the override to use a compiled version of the provider or something else. Since it's unrelated to the changes in the PR, I will still check in the code as-is.

Relations

Closes #37525

References

Referred to PR #33040 for similar fix.

Output from Acceptance Testing

$ make testacc TESTS=TestAccCloudTrail_serial/Trail PKG=cloudtrail
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/cloudtrail/... -v -count 1 -parallel 20 -run='TestAccCloudTrail_serial/Trail'  -timeout 360m
=== RUN   TestAccCloudTrail_serial
=== PAUSE TestAccCloudTrail_serial
=== CONT  TestAccCloudTrail_serial
=== RUN   TestAccCloudTrail_serial/Trail
=== RUN   TestAccCloudTrail_serial/Trail/tags
=== RUN   TestAccCloudTrail_serial/Trail/eventSelectorDynamoDB
=== RUN   TestAccCloudTrail_serial/Trail/eventSelectorExclude
=== RUN   TestAccCloudTrail_serial/Trail/advancedEventSelector
=== RUN   TestAccCloudTrail_serial/Trail/cloudwatch
=== RUN   TestAccCloudTrail_serial/Trail/multiRegion
=== RUN   TestAccCloudTrail_serial/Trail/basic
=== RUN   TestAccCloudTrail_serial/Trail/logValidation
=== RUN   TestAccCloudTrail_serial/Trail/eventSelector
=== RUN   TestAccCloudTrail_serial/Trail/disappears
=== RUN   TestAccCloudTrail_serial/Trail/enableLogging
=== RUN   TestAccCloudTrail_serial/Trail/globalServiceEvents
=== RUN   TestAccCloudTrail_serial/Trail/insightSelector
=== RUN   TestAccCloudTrail_serial/Trail/migrateV0
    cloudtrail_test.go:773: Step 1/2 error: Check failed: Check 4/4 error: aws_cloudtrail.test: Attribute 'id' expected "tf-acc-test-527020262212493675", got "arn:aws:cloudtrail:us-west-1:100180206982:trail/tf-acc-test-527020262212493675"
=== RUN   TestAccCloudTrail_serial/Trail/organization
    cloudtrail_test.go:262: this AWS account must be the management account of an AWS Organization
=== RUN   TestAccCloudTrail_serial/Trail/kmsKey
--- FAIL: TestAccCloudTrail_serial (658.02s)
    --- FAIL: TestAccCloudTrail_serial/Trail (658.02s)
        --- PASS: TestAccCloudTrail_serial/Trail/tags (53.35s)
        --- PASS: TestAccCloudTrail_serial/Trail/eventSelectorDynamoDB (27.60s)
        --- PASS: TestAccCloudTrail_serial/Trail/eventSelectorExclude (56.43s)
        --- PASS: TestAccCloudTrail_serial/Trail/advancedEventSelector (24.78s)
        --- PASS: TestAccCloudTrail_serial/Trail/cloudwatch (56.42s)
        --- PASS: TestAccCloudTrail_serial/Trail/multiRegion (53.49s)
        --- PASS: TestAccCloudTrail_serial/Trail/basic (41.93s)
        --- PASS: TestAccCloudTrail_serial/Trail/logValidation (38.70s)
        --- PASS: TestAccCloudTrail_serial/Trail/eventSelector (84.30s)
        --- PASS: TestAccCloudTrail_serial/Trail/disappears (23.52s)
        --- PASS: TestAccCloudTrail_serial/Trail/enableLogging (57.38s)
        --- PASS: TestAccCloudTrail_serial/Trail/globalServiceEvents (24.46s)
        --- PASS: TestAccCloudTrail_serial/Trail/insightSelector (67.89s)
        --- FAIL: TestAccCloudTrail_serial/Trail/migrateV0 (20.63s)
        --- SKIP: TestAccCloudTrail_serial/Trail/organization (0.78s)
        --- PASS: TestAccCloudTrail_serial/Trail/kmsKey (26.36s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/cloudtrail 658.214s
FAIL
make: *** [GNUmakefile:438: testacc] Error 1

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/cloudtrail Issues and PRs that pertain to the cloudtrail service. labels May 20, 2024
@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels May 20, 2024
@acwwat acwwat force-pushed the b-aws_cloudtrail-insight_type_list_to_set branch from 735b84f to 533228a Compare May 20, 2024 01:49
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. external-maintainer Contribution from a trusted external contributor. service/cloudtrail Issues and PRs that pertain to the cloudtrail service. size/XS 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.

[Bug]: aws_cloudtrail always shows changes due to switching insight_type values
2 participants