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_appautoscaling_target: Add suspended_state argument #38942

Conversation

evan-cleary
Copy link
Contributor

@evan-cleary evan-cleary commented Aug 20, 2024

Description

Adds the suspended_state argument to the aws_appautoscaling_target resource. This argument controls whether dynamic scaling, or scheduled scaling, policy actions are suspended or not

resource "aws_appautoscaling_target" "test" {
  ...

  suspended_state {
    dynamic_scaling_in_suspended  = true
    dynamic_scaling_out_suspended = false
    scheduled_scaling_suspended   = true
  }
}

Per AWS Documentation SuspendedState has 3 optional arguments DynamicScalingInSuspended, DynamicScalingOutSuspended, and ScheduledScalingSuspended with a default of false.

As implemented, providing the suspended_state argument without specifying any of the arguments is equivalent to setting all arguments to false.

  suspended_state {}
  // is equivalent to:
  suspended_state {
    dynamic_scaling_in_suspended  = false
    dynamic_scaling_out_suspended = false
    scheduled_scaling_suspended   = false
  }

The argument is implemented as optional and computed. This argument is computed to account for users who may be controlling these arguments outside of terraform and an inadvertent adjustment may impact their systems. As such, removing the suspended_state argument from a aws_appautoscaling_target will leave the last configuration of the argument in place.

Test Implemented

  • Existing target with manually applied suspended_state
  • Updating all arguments to true
  • Updating all arguments to false using empty block
  • Updating arguments independent of each other
  • Relinquish control of suspended_state and verify last values still present

Relations

Closes #9945

References

Output from Acceptance Testing

%  make testacc TESTS='TestAccAppAutoScalingTarget_suspendedState*' PKG=appautoscaling                                  

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/appautoscaling/... -v -count 1 -parallel 20 -run='TestAccAppAutoScalingTarget_suspendedState*'  -timeout 360m
=== RUN   TestAccAppAutoScalingTarget_suspendedState
=== PAUSE TestAccAppAutoScalingTarget_suspendedState
=== RUN   TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== PAUSE TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== CONT  TestAccAppAutoScalingTarget_suspendedState
=== CONT  TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
--- PASS: TestAccAppAutoScalingTarget_suspendedState (28.13s)
--- PASS: TestAccAppAutoScalingTarget_suspendedState_maintainsExisting (47.44s)

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 documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/appautoscaling Issues and PRs that pertain to the appautoscaling service. needs-triage Waiting for first response or review from a maintainer. labels Aug 20, 2024
@evan-cleary evan-cleary force-pushed the f-aws_appautoscaling_target-suspended_state branch from 72dc197 to 111773b Compare August 20, 2024 13:24
@evan-cleary evan-cleary force-pushed the f-aws_appautoscaling_target-suspended_state branch from 111773b to 5b7890e Compare August 20, 2024 13:44
@evan-cleary evan-cleary marked this pull request as ready for review August 20, 2024 13:53
@evan-cleary evan-cleary requested a review from a team as a code owner August 20, 2024 13:53
@evan-cleary
Copy link
Contributor Author

Full Test Run

%  make testacc TESTS='TestAccAppAutoScalingTarget_suspendedState_' PKG=appautoscaling  

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/appautoscaling/... -v -count 1 -parallel 20 -run='TestAccAppAutoScalingTarget_'  -timeout 360m
=== RUN   TestAccAppAutoScalingTarget_tags
=== PAUSE TestAccAppAutoScalingTarget_tags
=== RUN   TestAccAppAutoScalingTarget_tags_null
=== PAUSE TestAccAppAutoScalingTarget_tags_null
=== RUN   TestAccAppAutoScalingTarget_tags_AddOnUpdate
=== PAUSE TestAccAppAutoScalingTarget_tags_AddOnUpdate
=== RUN   TestAccAppAutoScalingTarget_tags_EmptyTag_OnCreate
    target_tags_gen_test.go:351: Resource Target does not support empty tags
--- SKIP: TestAccAppAutoScalingTarget_tags_EmptyTag_OnCreate (0.00s)
=== RUN   TestAccAppAutoScalingTarget_tags_EmptyTag_OnUpdate_Add
    target_tags_gen_test.go:444: Resource Target does not support empty tags
--- SKIP: TestAccAppAutoScalingTarget_tags_EmptyTag_OnUpdate_Add (0.00s)
=== RUN   TestAccAppAutoScalingTarget_tags_EmptyTag_OnUpdate_Replace
    target_tags_gen_test.go:585: Resource Target does not support empty tags
--- SKIP: TestAccAppAutoScalingTarget_tags_EmptyTag_OnUpdate_Replace (0.00s)
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_providerOnly
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_providerOnly
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_nonOverlapping
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_overlapping
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_overlapping
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_updateToProviderOnly
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_updateToProviderOnly
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_updateToResourceOnly
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_updateToResourceOnly
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_emptyResourceTag
    target_tags_gen_test.go:1385: Resource Target does not support empty tags
--- SKIP: TestAccAppAutoScalingTarget_tags_DefaultTags_emptyResourceTag (0.00s)
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_emptyProviderOnlyTag
    target_tags_gen_test.go:1453: Resource Target does not support empty tags
--- SKIP: TestAccAppAutoScalingTarget_tags_DefaultTags_emptyProviderOnlyTag (0.00s)
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_nullOverlappingResourceTag
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_nullOverlappingResourceTag
=== RUN   TestAccAppAutoScalingTarget_tags_DefaultTags_nullNonOverlappingResourceTag
=== PAUSE TestAccAppAutoScalingTarget_tags_DefaultTags_nullNonOverlappingResourceTag
=== RUN   TestAccAppAutoScalingTarget_tags_ComputedTag_OnCreate
=== PAUSE TestAccAppAutoScalingTarget_tags_ComputedTag_OnCreate
=== RUN   TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Add
=== PAUSE TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Add
=== RUN   TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Replace
=== PAUSE TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Replace
=== RUN   TestAccAppAutoScalingTarget_basic
=== PAUSE TestAccAppAutoScalingTarget_basic
=== RUN   TestAccAppAutoScalingTarget_disappears
=== PAUSE TestAccAppAutoScalingTarget_disappears
=== RUN   TestAccAppAutoScalingTarget_spotFleetRequest
=== PAUSE TestAccAppAutoScalingTarget_spotFleetRequest
=== RUN   TestAccAppAutoScalingTarget_emrCluster
=== PAUSE TestAccAppAutoScalingTarget_emrCluster
=== RUN   TestAccAppAutoScalingTarget_multipleTargets
=== PAUSE TestAccAppAutoScalingTarget_multipleTargets
=== RUN   TestAccAppAutoScalingTarget_optionalRoleARN
=== PAUSE TestAccAppAutoScalingTarget_optionalRoleARN
=== RUN   TestAccAppAutoScalingTarget_suspendedState
=== PAUSE TestAccAppAutoScalingTarget_suspendedState
=== RUN   TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== PAUSE TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== CONT  TestAccAppAutoScalingTarget_tags
=== CONT  TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Add
=== CONT  TestAccAppAutoScalingTarget_emrCluster
=== CONT  TestAccAppAutoScalingTarget_disappears
=== CONT  TestAccAppAutoScalingTarget_basic
=== CONT  TestAccAppAutoScalingTarget_suspendedState
=== CONT  TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_providerOnly
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_overlapping
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_nonOverlapping
=== CONT  TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Replace
=== CONT  TestAccAppAutoScalingTarget_optionalRoleARN
=== CONT  TestAccAppAutoScalingTarget_tags_AddOnUpdate
=== CONT  TestAccAppAutoScalingTarget_multipleTargets
=== CONT  TestAccAppAutoScalingTarget_tags_null
=== CONT  TestAccAppAutoScalingTarget_spotFleetRequest
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_nullOverlappingResourceTag
=== CONT  TestAccAppAutoScalingTarget_tags_ComputedTag_OnCreate
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_updateToProviderOnly
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_nullNonOverlappingResourceTag
--- PASS: TestAccAppAutoScalingTarget_optionalRoleARN (32.93s)
=== CONT  TestAccAppAutoScalingTarget_tags_DefaultTags_updateToResourceOnly
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_nullNonOverlappingResourceTag (41.49s)
--- PASS: TestAccAppAutoScalingTarget_multipleTargets (44.17s)
--- PASS: TestAccAppAutoScalingTarget_tags_ComputedTag_OnCreate (46.22s)
--- PASS: TestAccAppAutoScalingTarget_suspendedState (47.11s)
--- PASS: TestAccAppAutoScalingTarget_tags_null (48.63s)
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_nullOverlappingResourceTag (52.92s)
--- PASS: TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Replace (60.70s)
--- PASS: TestAccAppAutoScalingTarget_tags_AddOnUpdate (61.19s)
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_updateToProviderOnly (62.39s)
--- PASS: TestAccAppAutoScalingTarget_tags_ComputedTag_OnUpdate_Add (63.75s)
--- PASS: TestAccAppAutoScalingTarget_suspendedState_maintainsExisting (67.70s)
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_updateToResourceOnly (40.88s)
--- PASS: TestAccAppAutoScalingTarget_spotFleetRequest (74.77s)
--- PASS: TestAccAppAutoScalingTarget_disappears (75.02s)
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_overlapping (76.03s)
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_nonOverlapping (79.10s)
--- PASS: TestAccAppAutoScalingTarget_tags (82.43s)
--- PASS: TestAccAppAutoScalingTarget_tags_DefaultTags_providerOnly (87.81s)
--- PASS: TestAccAppAutoScalingTarget_basic (91.61s)
=== NAME  TestAccAppAutoScalingTarget_emrCluster
    target_test.go:128: Error running post-test destroy, there may be dangling resources: exit status 1
        
        Error: deleting IAM Role (tf-acc-test-7519770681783667716_profile_role): operation error IAM: DeleteRole, https response error StatusCode: 409, RequestID: e5c26eb6-f415-4a69-80ea-8e334fc05dc5, DeleteConflict: Cannot delete entity, must detach all policies first.
        
--- FAIL: TestAccAppAutoScalingTarget_emrCluster (704.87s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/appautoscaling     709.143s
FAIL

EMR test failed at cleanup

@justinretzolk justinretzolk 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 Aug 20, 2024
@ewbankkit ewbankkit self-assigned this Aug 21, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 21, 2024
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=TestAccAppAutoScalingTarget_basic\|TestAccAppAutoScalingTarget_suspendedState' PKG=appautoscaling
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/appautoscaling/... -v -count 1 -parallel 20  -run=TestAccAppAutoScalingTarget_basic\|TestAccAppAutoScalingTarget_suspendedState -timeout 360m
=== RUN   TestAccAppAutoScalingTarget_basic
=== PAUSE TestAccAppAutoScalingTarget_basic
=== RUN   TestAccAppAutoScalingTarget_suspendedState
=== PAUSE TestAccAppAutoScalingTarget_suspendedState
=== RUN   TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== PAUSE TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== CONT  TestAccAppAutoScalingTarget_basic
=== CONT  TestAccAppAutoScalingTarget_suspendedState_maintainsExisting
=== CONT  TestAccAppAutoScalingTarget_suspendedState
--- PASS: TestAccAppAutoScalingTarget_suspendedState (30.15s)
--- PASS: TestAccAppAutoScalingTarget_suspendedState_maintainsExisting (44.94s)
--- PASS: TestAccAppAutoScalingTarget_basic (81.72s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/appautoscaling	86.606s

@ewbankkit
Copy link
Contributor

@evan-cleary Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit b0e9db4 into hashicorp:main Aug 21, 2024
45 checks passed
@github-actions github-actions bot added this to the v5.64.0 milestone Aug 21, 2024
@evan-cleary evan-cleary deleted the f-aws_appautoscaling_target-suspended_state branch August 21, 2024 16:31
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 22, 2024
Copy link

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

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 Sep 23, 2024
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. 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.

AWS Application Auto Scaling suspend/resume scaling
3 participants