-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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_eip: Do not disassociate on tags-only update #2975
Conversation
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.
Just a few nitpicks left about readability of the code, otherwise LGTM.
aws/resource_aws_eip.go
Outdated
if (d.Get("instance").(string) != "" || d.Get("association_id").(string) != "") && !d.IsNewResource() { | ||
disassociate := false | ||
if !d.IsNewResource() { | ||
if (d.Get("instance").(string) != "") && d.HasChange("instance") { |
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.
Nitpicks: The brackets here are unnecessary + I think it would make a bit more sense (when trying to read the code) if it was reversed, i.e.
if d.HasChange("instance") && d.Get("instance").(string) != "" {
aws/resource_aws_eip.go
Outdated
if !d.IsNewResource() { | ||
if (d.Get("instance").(string) != "") && d.HasChange("instance") { | ||
disassociate = true | ||
} else if (d.Get("association_id").(string) != "") && (d.HasChange("network_interface") || d.HasChange("associate_with_private_ip")) { |
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.
Nitpicks: As above - I'd omit the brackets and reverse ordering of HasChange
and Get
.
aws/resource_aws_eip.go
Outdated
associate := false | ||
if ok_instance && d.HasChange("instance") { | ||
associate = true | ||
} else if ok_interface && (d.HasChange("network_interface") || d.HasChange("associate_with_private_ip")) { |
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.
Nitpicks: In addition to what I already mentioned above would you mind moving the two variable definitions closer to where they're being actually used (meaning ok_instance
& ok_interface
in this context).
* Adjust ordering of disassociate/associate boolean logic for readability * Remove extraneous boolean parenthesis
This has been released in terraform-provider-aws version 1.7.1. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
* Adjust ordering of disassociate/associate boolean logic for readability * Remove extraneous boolean parenthesis
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! |
Fixes #2968