-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
provider/aws: Refresh aws_autoscaling_policy
from state on 404
#8430
Conversation
Fixes #8386 When an Autoscaling Group Or an Autoscaling Group Policy has been deleted manually, terraform was throwing an error as follows: ``` * aws_autoscaling_policy.increase: Error retrieving scaling policies: ValidationError: Group sandbox-logs-logstash-wxhsckky3ndpzd7b3kmyontngy not found status code: 400, request id: 56a89814-6884-11e6-b3a8-d364cf04223b ``` We now refresh from state on a ValidationError - this is a common 4xx error according to AWS documentation http://docs.aws.amazon.com/AutoScaling/latest/APIReference/CommonErrors.html ``` %make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAutoscalingPolicy_disappears' ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAutoscalingPolicy_disappears -timeout 120m === RUN TestAccAWSAutoscalingPolicy_disappears --- PASS: TestAccAWSAutoscalingPolicy_disappears (203.61s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 203.633s ```
@@ -271,6 +272,13 @@ func getAwsAutoscalingPolicy(d *schema.ResourceData, meta interface{}) (*autosca | |||
log.Printf("[DEBUG] AutoScaling Scaling Policy Describe Params: %#v", params) | |||
resp, err := autoscalingconn.DescribePolicies(¶ms) | |||
if err != nil { | |||
//A ValidationError here can mean that either the Policy is missing OR the Autoscaling Group is missing | |||
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "ValidationError" { | |||
log.Printf("[WARNING] %s not found, refreshing from state", d.Id()) |
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.
should say "removing" from state?
Minor gripe on the log message wording otherwise LGTM. |
…hicorp#8430) * provider/aws: Refresh `aws_autoscaling_policy` from state on 404 Fixes hashicorp#8386 When an Autoscaling Group Or an Autoscaling Group Policy has been deleted manually, terraform was throwing an error as follows: ``` * aws_autoscaling_policy.increase: Error retrieving scaling policies: ValidationError: Group sandbox-logs-logstash-wxhsckky3ndpzd7b3kmyontngy not found status code: 400, request id: 56a89814-6884-11e6-b3a8-d364cf04223b ``` We now refresh from state on a ValidationError - this is a common 4xx error according to AWS documentation http://docs.aws.amazon.com/AutoScaling/latest/APIReference/CommonErrors.html ``` %make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAutoscalingPolicy_disappears' ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAutoscalingPolicy_disappears -timeout 120m === RUN TestAccAWSAutoscalingPolicy_disappears --- PASS: TestAccAWSAutoscalingPolicy_disappears (203.61s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 203.633s ``` * Update resource_aws_autoscaling_policy.go
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes #8386
When an Autoscaling Group Or an Autoscaling Group Policy has been
deleted manually, terraform was throwing an error as follows:
We now refresh from state on a ValidationError - this is a common 4xx error according to AWS documentation http://docs.aws.amazon.com/AutoScaling/latest/APIReference/CommonErrors.html