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_autoscaling_policy: Replace GetOk with GetOkExists #2809

Merged
merged 3 commits into from
Feb 16, 2018

Conversation

atsushi-ishibashi
Copy link
Contributor

Fixed: #2528
When you specify 0, GetOk returns false as exists so replaced with GetOkExists.

@radeksimko radeksimko added the bug Addresses a defect in current functionality. label Jan 2, 2018
@radeksimko radeksimko added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 16, 2018
@radeksimko radeksimko changed the title r/autoscaling_policy: Replace GetOk with GetOkExists resource/aws_autoscaling_policy: Replace GetOk with GetOkExists Jan 16, 2018
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

@atsushi-ishibashi
This looks like a reasonable patch 👍 Can you also add a test case which verifies it (i.e. config where the affected fields are undefined)?

Thanks.

@radeksimko radeksimko added waiting-response Maintainers are waiting on response from community or contributor. service/autoscaling Issues and PRs that pertain to the autoscaling service. and removed service/ec2 Issues and PRs that pertain to the ec2 service. labels Feb 8, 2018
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Feb 10, 2018
@atsushi-ishibashi
Copy link
Contributor Author

TF_ACC=1 go test ./aws -v -run=TestAccAWSAutoscalingPolicy_zerovalue -timeout 120m
=== RUN   TestAccAWSAutoscalingPolicy_zerovalue
--- PASS: TestAccAWSAutoscalingPolicy_zerovalue (115.46s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	115.487s

I got the below error so added validation.IntAtLeast(1) as ValidateFunc.

aws_autoscaling_policy.foobar_step: Error putting scaling policy: ValidationError: If specified, MinAdjustmentMagnitude must be greater than zero.

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Feb 16, 2018
@radeksimko
Copy link
Member

I was tempted to say that we're not really testing the new behaviour, because AWS API just doesn't return the default value (300), but nil instead, which d.Set() then turns back into 0.
This made me think we could only call d.Set() if the field isn't nil, but that might break some people's configs where they're referencing the field in conditionals, so it's probably ok to leave it as is. 🤷‍♂️

I just rebased your branch and resolved conflicts for you, so we can 🚢 this.

Thanks for the PR, as always! 👍

@radeksimko radeksimko merged commit 8918178 into hashicorp:master Feb 16, 2018
@radeksimko radeksimko added this to the v1.10.0 milestone Feb 16, 2018
@bflad
Copy link
Contributor

bflad commented Feb 27, 2018

This has been released in version 1.10.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
@breathingdust breathingdust removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 17, 2021
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. service/autoscaling Issues and PRs that pertain to the autoscaling service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ASG scale in/out cooldown with zero value not set correctly
4 participants