-
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
service/elbv2: Prevent panics with actions deleted outside Terraform #6319
Conversation
We will now always sort the API response by Action.Order for reading into the Terraform state. This could potentially cause a plan difference in configurations which list actions out of order so will need a note in the CHANGELOG, however this behavior seems more desirable than switching to schema.TypeSet and removing the ability to omit order from configurations. Previously: ``` === CONT TestAccAWSLBListener_DefaultAction_Order_Recreates panic: runtime error: index out of range goroutine 2681 [running]: github.com/terraform-providers/terraform-provider-aws/aws.sortActionsBasedonTypeinTFFile(0x441e604, 0xe, 0xc00000f5f0, 0x1, 0x1, 0xc00078ddc0, 0x0, 0xc000702ac0, 0x39eee80) /Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/structure.go:1918 +0x313 github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbListenerRead(0xc00078ddc0, 0x3e81980, 0xc0005f6000, 0xc00078ddc0, 0x0) /Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_listener.go:553 +0x3ff === CONT TestAccAWSLBListenerRule_Action_Order_Recreates panic: runtime error: index out of range goroutine 2952 [running]: github.com/terraform-providers/terraform-provider-aws/aws.sortActionsBasedonTypeinTFFile(0x440a5f0, 0x6, 0xc000612aa0, 0x1, 0x1, 0xc000320000, 0x0, 0xc000cb91f0, 0x1015115) /Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/structure.go:1918 +0x313 github.com/terraform-providers/terraform-provider-aws/aws.resourceAwsLbListenerRuleRead(0xc000320000, 0x3e82320, 0xc00078c000, 0xc000320000, 0x0) /Users/bflad/go/src/github.com/terraform-providers/terraform-provider-aws/aws/resource_aws_lb_listener_rule.go:560 +0x3a2 ``` Output from acceptance testing: ``` --- PASS: TestAccAWSLBListenerRule_Action_Order_Recreates (252.06s) --- PASS: TestAccAWSLBListener_DefaultAction_Order_Recreates (224.20s) ```
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
This has been released in version 1.43.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! |
We will now always sort the API response by Action.Order for reading into the Terraform state. This could potentially cause a plan difference in configurations which list actions out of order so will need a note in the CHANGELOG, however this behavior seems more desirable than switching to schema.TypeSet and removing the ability to omit order from configurations.
Fixes #6171
Fixes #6256
Changes proposed in this pull request:
sortActionsBasedonTypeinTFFile()
which did not account for actions performed outside Terraform and instead sortlistener.DefaultActions
byOrder
andrule.Actions
byOrder
Previously:
Output from acceptance testing: