-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix BackendService group hash when instance groups use beta features #522
Conversation
continue | ||
} | ||
|
||
if k == "backend.#" { |
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.
You could move it in the if above with a ||
.
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.
Done
StateVersion: 0, | ||
Attributes: map[string]string{ | ||
"backend.#": "1", | ||
"backend.242332812.group": "https://www.googleapis.com/compute/v1/projects/project_name/zones/zone_name/instances/instanceGroups/igName", |
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.
You could add also a test with a beta group. Even though it wouldn't add much value I guess...
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.
Eh, not going to bother on this one since this test doesn't make any API calls or really look at the version
…ashicorp#522) * change backend hash function * update if statement
…ashicorp#522) * change backend hash function * update if statement
<!-- This change is generated by MagicModules. --> /cc @rileykarson
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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Fixes #462.
The issue in #462 was that
backend.group
takes a self link of an instance group. Instance Group Managers have a beta field,auto_healing_policies
. If that is set, then its self link will be the beta one since we have to read from the beta API in order to read that field. In that case, the example config ended up such that state had the v1 self link (because it reads from the v1 BackendServices API) but plan wanted to change it to a beta self link (because it reads from the beta InstanceGroupManagers API).The link of the instance group is one of the factors that makes up the hash for the backend. In order to make sure changes in api version don't impact the backend hash, I've changed it to use the relative path instead of the full self link. Since this changes the value of the hash, I added a state migration.
While I was in the neighborhood, I also changed
group
to Required since it'll fail server-side if it's not set (and our documentation actually says it's Required) and added a self link DiffSuppress for it.