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_vpclattice_access_log_subscription: Show actionable error message when CloudWatch Logs destination_arn is not suffixed with wildcard #32186

Conversation

exoego
Copy link
Contributor

@exoego exoego commented Jun 23, 2023

Description

When CloudWatch Logs is the destination, destination_arn should end with :*.
So, if the given destination_arn does not end with :*, actionable error message is shown.

Relations

Closes #31595

References

N/A

Output from Acceptance Testing

BEFORE (without fixes)

❯ make testacc TESTS=TestAccVPCLatticeAccessLogSubscription_ PKG=vpclattice

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/vpclattice/... -v -count 1 -parallel 20 -run='TestAccVPCLatticeAccessLogSubscription_'  -timeout 180m
=== RUN   TestAccVPCLatticeAccessLogSubscription_basic
=== PAUSE TestAccVPCLatticeAccessLogSubscription_basic
=== RUN   TestAccVPCLatticeAccessLogSubscription_disappears
=== PAUSE TestAccVPCLatticeAccessLogSubscription_disappears
=== RUN   TestAccVPCLatticeAccessLogSubscription_tags
=== PAUSE TestAccVPCLatticeAccessLogSubscription_tags
=== RUN   TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard
=== PAUSE TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard
=== RUN   TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
=== PAUSE TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_basic
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_tags
=== CONT  TestAccVPCLatticeAccessLogSubscription_disappears
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
    access_log_subscription_test.go:168: Step 1/1, expected an error with pattern, no match on: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
        -/+ destroy and then create replacement
        
        Terraform will perform the following actions:
        
          # aws_vpclattice_access_log_subscription.test must be replaced
        -/+ resource "aws_vpclattice_access_log_subscription" "test" {
              ~ arn                 = "arn:aws:vpc-lattice:us-west-2:523683666290:accesslogsubscription/als-0c23d9c173fc29692" -> (known after apply)
              ~ destination_arn     = "arn:aws:logs:us-west-2:523683666290:log-group:/aws/vpclattice/tf-acc-test-778914506082713889:*" -> "arn:aws:logs:us-west-2:523683666290:log-group:/aws/vpclattice/tf-acc-test-778914506082713889" # forces replacement
              ~ id                  = "als-0c23d9c173fc29692" -> (known after apply)
              ~ resource_arn        = "arn:aws:vpc-lattice:us-west-2:523683666290:servicenetwork/sn-0f21f608d9001de1b" -> (known after apply)
              ~ tags_all            = {} -> (known after apply)
                # (1 unchanged attribute hidden)
            }
        
        Plan: 1 to add, 0 to change, 1 to destroy.
--- FAIL: TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard (27.58s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard (34.42s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_disappears (47.58s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_basic (72.18s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_tags (117.09s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice 120.204s
FAIL
make: *** [testacc] Error 1

AFTER (with fixes)

$ make testacc TESTS=TestAccVPCLatticeAccessLogSubscription_ PKG=vpclattice 

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/vpclattice/... -v -count 1 -parallel 20 -run='TestAccVPCLatticeAccessLogSubscription_'  -timeout 180m
=== RUN   TestAccVPCLatticeAccessLogSubscription_basic
=== PAUSE TestAccVPCLatticeAccessLogSubscription_basic
=== RUN   TestAccVPCLatticeAccessLogSubscription_disappears
=== PAUSE TestAccVPCLatticeAccessLogSubscription_disappears
=== RUN   TestAccVPCLatticeAccessLogSubscription_tags
=== PAUSE TestAccVPCLatticeAccessLogSubscription_tags
=== RUN   TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard
=== PAUSE TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard
=== RUN   TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
=== PAUSE TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_basic
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_tags
=== CONT  TestAccVPCLatticeAccessLogSubscription_disappears
--- PASS: TestAccVPCLatticeAccessLogSubscription_cloudwatch_fail_without_wildcard (19.77s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_cloudwatch_wildcard (32.53s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_basic (48.15s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_disappears (61.12s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_tags (111.51s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice 114.658s

@github-actions
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 service/vpclattice Issues and PRs that pertain to the vpclattice service. size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Jun 23, 2023
@exoego exoego changed the title r r/aws_vpclattice_access_log_subscription: Do not force-replace when no changes Jun 23, 2023
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 23, 2023
@exoego exoego changed the title r/aws_vpclattice_access_log_subscription: Do not force-replace when no changes r/aws_vpclattice_access_log_subscription: Show actionable error message when CloudWatch Logs destination_arn is not suffixed with wildcard Jun 26, 2023
@exoego exoego force-pushed the r-aws_vpclattice_access_log_subscription-bugfix-31595 branch from 7d507e4 to 5e507de Compare June 26, 2023 07:39
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Jun 26, 2023
@exoego exoego force-pushed the r-aws_vpclattice_access_log_subscription-bugfix-31595 branch from 5e507de to 1b7c32c Compare June 26, 2023 07:43
@exoego exoego marked this pull request as ready for review June 26, 2023 07:46
@exoego exoego force-pushed the r-aws_vpclattice_access_log_subscription-bugfix-31595 branch from 1b7c32c to 3fb536e Compare June 27, 2023 01:22
@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Jun 27, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccVPCLatticeAccessLogSubscription_' PKG=vpclattice ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/vpclattice/... -v -count 1 -parallel 2  -run=TestAccVPCLatticeAccessLogSubscription_ -timeout 180m
=== RUN   TestAccVPCLatticeAccessLogSubscription_basic
=== PAUSE TestAccVPCLatticeAccessLogSubscription_basic
=== RUN   TestAccVPCLatticeAccessLogSubscription_disappears
=== PAUSE TestAccVPCLatticeAccessLogSubscription_disappears
=== RUN   TestAccVPCLatticeAccessLogSubscription_arn
=== PAUSE TestAccVPCLatticeAccessLogSubscription_arn
=== RUN   TestAccVPCLatticeAccessLogSubscription_tags
=== PAUSE TestAccVPCLatticeAccessLogSubscription_tags
=== RUN   TestAccVPCLatticeAccessLogSubscription_cloudwatchNoWildcard
=== PAUSE TestAccVPCLatticeAccessLogSubscription_cloudwatchNoWildcard
=== RUN   TestAccVPCLatticeAccessLogSubscription_cloudwatchWildcard
=== PAUSE TestAccVPCLatticeAccessLogSubscription_cloudwatchWildcard
=== CONT  TestAccVPCLatticeAccessLogSubscription_basic
=== CONT  TestAccVPCLatticeAccessLogSubscription_tags
--- PASS: TestAccVPCLatticeAccessLogSubscription_basic (33.08s)
=== CONT  TestAccVPCLatticeAccessLogSubscription_arn
--- PASS: TestAccVPCLatticeAccessLogSubscription_arn (31.52s)
=== CONT  TestAccVPCLatticeAccessLogSubscription_disappears
--- PASS: TestAccVPCLatticeAccessLogSubscription_tags (74.95s)
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatchWildcard
--- PASS: TestAccVPCLatticeAccessLogSubscription_disappears (28.13s)
=== CONT  TestAccVPCLatticeAccessLogSubscription_cloudwatchNoWildcard
--- PASS: TestAccVPCLatticeAccessLogSubscription_cloudwatchWildcard (27.29s)
--- PASS: TestAccVPCLatticeAccessLogSubscription_cloudwatchNoWildcard (26.09s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice	124.017s

@ewbankkit
Copy link
Contributor

@exoego Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 5acb678 into hashicorp:main Jul 27, 2023
@github-actions github-actions bot added this to the v5.10.0 milestone Jul 27, 2023
@github-actions
Copy link

This functionality has been released in v5.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. Thank you!

@exoego exoego deleted the r-aws_vpclattice_access_log_subscription-bugfix-31595 branch August 3, 2023 20:43
@github-actions
Copy link

github-actions bot commented Sep 4, 2023

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 Sep 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/vpclattice Issues and PRs that pertain to the vpclattice service. size/M 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]: plan generation always causes aws_vpclattice_access_log_subscription replacement
3 participants