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/aws_appautoscalingpolicy: add computed attribute alarmARNs #27011

Merged
merged 7 commits into from
Sep 29, 2022

Conversation

jochenboesmans
Copy link
Contributor

Description

This is a suggested enhancement based on my own enhancement request here: #27010

The idea is to have an attribute with a list of the ARNs of the cloudwatch alarms that are managing an app autoscaling policy such as a TargetTrackingPolicy. This is useful data for external systems in order to be able to enable/disable the autoscaling behavior for example.

Relations

Closes #27010

References

Output from Acceptance Testing

$ make testacc TESTS=TestAccAppAutoScalingPolicy PKG=appautoscaling                                                  
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/appautoscaling/... -v -count 1 -parallel 20 -run='TestAccAppAutoScalingPolicy'  -timeout 180m
=== RUN   TestAccAppAutoScalingPolicy_basic
=== PAUSE TestAccAppAutoScalingPolicy_basic
=== RUN   TestAccAppAutoScalingPolicy_disappears
=== PAUSE TestAccAppAutoScalingPolicy_disappears
=== RUN   TestAccAppAutoScalingPolicy_scaleOutAndIn
=== PAUSE TestAccAppAutoScalingPolicy_scaleOutAndIn
=== RUN   TestAccAppAutoScalingPolicy_spotFleetRequest
=== PAUSE TestAccAppAutoScalingPolicy_spotFleetRequest
=== RUN   TestAccAppAutoScalingPolicy_DynamoDB_table
=== PAUSE TestAccAppAutoScalingPolicy_DynamoDB_table
=== RUN   TestAccAppAutoScalingPolicy_DynamoDB_index
=== PAUSE TestAccAppAutoScalingPolicy_DynamoDB_index
=== RUN   TestAccAppAutoScalingPolicy_multiplePoliciesSameName
=== PAUSE TestAccAppAutoScalingPolicy_multiplePoliciesSameName
=== RUN   TestAccAppAutoScalingPolicy_multiplePoliciesSameResource
=== PAUSE TestAccAppAutoScalingPolicy_multiplePoliciesSameResource
=== RUN   TestAccAppAutoScalingPolicy_ResourceID_forceNew
=== PAUSE TestAccAppAutoScalingPolicy_ResourceID_forceNew
=== CONT  TestAccAppAutoScalingPolicy_basic
=== CONT  TestAccAppAutoScalingPolicy_DynamoDB_index
=== CONT  TestAccAppAutoScalingPolicy_multiplePoliciesSameName
=== CONT  TestAccAppAutoScalingPolicy_multiplePoliciesSameResource
=== CONT  TestAccAppAutoScalingPolicy_ResourceID_forceNew
=== CONT  TestAccAppAutoScalingPolicy_spotFleetRequest
=== CONT  TestAccAppAutoScalingPolicy_DynamoDB_table
=== CONT  TestAccAppAutoScalingPolicy_scaleOutAndIn
=== CONT  TestAccAppAutoScalingPolicy_disappears
=== CONT  TestAccAppAutoScalingPolicy_spotFleetRequest
    policy_test.go:234: Step 1/2 error: Error running apply: exit status 1
        
        Error: failed creating IAM Role ***REDACTED***: AccessDenied: User: ***REDACTED*** is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::***REDACTED*** because no identity-based policy allows the iam:CreateRole action
                status code: 403, request id: ***REDACTED***
        
          with aws_iam_role.fleet_role,
          on terraform_plugin_test.tf line 19, in resource "aws_iam_role" "fleet_role":
          19: resource "aws_iam_role" "fleet_role" {
        
--- FAIL: TestAccAppAutoScalingPolicy_spotFleetRequest (7.34s)
--- PASS: TestAccAppAutoScalingPolicy_multiplePoliciesSameName (23.12s)
--- PASS: TestAccAppAutoScalingPolicy_DynamoDB_table (24.30s)
--- PASS: TestAccAppAutoScalingPolicy_multiplePoliciesSameResource (25.20s)
--- PASS: TestAccAppAutoScalingPolicy_DynamoDB_index (30.29s)
--- PASS: TestAccAppAutoScalingPolicy_disappears (59.78s)
--- PASS: TestAccAppAutoScalingPolicy_basic (81.59s)
--- PASS: TestAccAppAutoScalingPolicy_ResourceID_forceNew (89.10s)
--- PASS: TestAccAppAutoScalingPolicy_scaleOutAndIn (93.85s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/appautoscaling     96.548s
FAIL
make: *** [testacc] Error 1

All acceptance tests succeed except for the spotFleetRequest one because it needs iam:CreateRole permissions, to which I don't have access because of security reasons.

@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/appautoscaling Issues and PRs that pertain to the appautoscaling service. needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. labels Sep 28, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @jochenboesmans 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@ewbankkit ewbankkit added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 29, 2022
@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/M 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 Sep 29, 2022
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=TestAccAppAutoScalingPolicy_basic\|TestAccAppAutoScalingPolicy_disappears' PKG=appautoscaling
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/appautoscaling/... -v -count 1 -parallel 20  -run=TestAccAppAutoScalingPolicy_basic\|TestAccAppAutoScalingPolicy_disappears -timeout 180m
=== RUN   TestAccAppAutoScalingPolicy_basic
=== PAUSE TestAccAppAutoScalingPolicy_basic
=== RUN   TestAccAppAutoScalingPolicy_disappears
=== PAUSE TestAccAppAutoScalingPolicy_disappears
=== CONT  TestAccAppAutoScalingPolicy_basic
=== CONT  TestAccAppAutoScalingPolicy_disappears
--- PASS: TestAccAppAutoScalingPolicy_disappears (71.11s)
--- PASS: TestAccAppAutoScalingPolicy_basic (97.91s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/appautoscaling	102.423s

@ewbankkit
Copy link
Contributor

@jochenboesmans Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit d0f15cf into hashicorp:main Sep 29, 2022
@github-actions github-actions bot added this to the v4.33.0 milestone Sep 29, 2022
@github-actions
Copy link

This functionality has been released in v4.33.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 Oct 30, 2022
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. enhancement Requests to existing resources that expand the functionality or scope. service/appautoscaling Issues and PRs that pertain to the appautoscaling 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
2 participants