-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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/autoscaling_policy: fix conditional logic based on policy type #3739
resource/autoscaling_policy: fix conditional logic based on policy type #3739
Conversation
f3c3e99
to
738e6ae
Compare
|
I expect this will fix #3689 also |
8d81b75
to
f748693
Compare
Can we get this merged? This is actively breaking us in Prod as well. |
We're only a few days out from the initial report and there is a complete PR. Thank you, @loivis! |
When could this be merged? I am unsure if the documentation for autoscaling_policy works in its current state at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for fixing this. Sorry this took some extra time for review since it was quite large.
7 tests passed (all tests)
=== RUN TestAccAWSAutoscalingPolicy_TargetTrack_Predefined
--- PASS: TestAccAWSAutoscalingPolicy_TargetTrack_Predefined (56.48s)
=== RUN TestAccAWSAutoscalingPolicy_TargetTrack_Custom
--- PASS: TestAccAWSAutoscalingPolicy_TargetTrack_Custom (59.59s)
=== RUN TestAccAWSAutoscalingPolicy_zerovalue
--- PASS: TestAccAWSAutoscalingPolicy_zerovalue (61.08s)
=== RUN TestAccAWSAutoscalingPolicy_SimpleScalingStepAdjustment
--- PASS: TestAccAWSAutoscalingPolicy_SimpleScalingStepAdjustment (74.00s)
=== RUN TestAccAWSAutoscalingPolicy_disappears
--- PASS: TestAccAWSAutoscalingPolicy_disappears (98.28s)
=== RUN TestAccAWSAutoscalingPolicy_upgrade
--- PASS: TestAccAWSAutoscalingPolicy_upgrade (121.46s)
=== RUN TestAccAWSAutoscalingPolicy_basic
--- PASS: TestAccAWSAutoscalingPolicy_basic (123.73s)
This has been released in version 1.13.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
fix #3715
fix #3689
Issue with current approach is that even user doesn't set the argument, it will be set to
zero
in terraform state from aws api response as placeholder. Later on during update,zero
value is used thus trigger the error. One way to fix is to add conditional logic in read function as well. I'm not feeling comfortable with this because multiple conditions are introduced to handle the same situation.Instead, I'm changing the logic in the same place to set arguments only for valid policy types. With checking policy type before setting input parameter, it's also easily compare each parameter with api specification.
I didn't figure out how to distinguish
zero
value between user input and terraform state value in current logic but that's not the focus here.