-
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
Change group back to Optional in google_compute_backend_service
#576
Conversation
(not actually looking for 3 reviews, just whichever of you get to it first) |
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.
Tiny nitpick about error string, other than that, LGTM.
backends := make([]*compute.Backend, 0, len(configured)) | ||
|
||
for _, raw := range configured { | ||
data := raw.(map[string]interface{}) | ||
|
||
g, ok := data["group"] | ||
if !ok { | ||
return nil, errors.New("google_compute_backend_service.backend.group must be set") |
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.
This resource address may not actually be right, if the user names their backend something other than "backend". I'd prefer something along the lines of fmt.Errorf("group field on backend %q must be set", backend.SelfLink)
, but that's just me.
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.
the address wouldn't contain the name of the backend though, that would be the value. the address would technically be something like google_compute_backend_service.backend.<hash>.group
but I figured omitting the hash was fine in this case. We can't use the self link because there isn't a compute.Backend
object to take the self link of
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.
I could use the index, I guess. Would that work better?
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.
Ah, no, I'm just confused. Ignore me, nitpick withdrawn. :)
…shicorp#576) * change group back to optional * fix build
…shicorp#576) * change group back to optional * fix build
) <!-- 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 👉 hashibot-feedback@hashicorp.com. Thanks! |
#522 changed group to Required, since it would fail at apply-time anyway if it isn't set. However, this actually breaks our published modules (hashicorp/terraform#16306). To avoid that breakage for the next release, I changed it back to Optional and while I was there, added some extra checks to ensure it's actually set so it fails with an actual error message instead of a panic.