Skip to content
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

Merged
merged 2 commits into from
Oct 12, 2017

Conversation

danawillow
Copy link
Contributor

#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.

$ make testacc TEST=./google TESTARGS='-run=TestAccComputeBackendService'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./google -v -run=TestAccComputeBackendService -timeout 120m
=== RUN   TestAccComputeBackendService_importBasic
--- PASS: TestAccComputeBackendService_importBasic (44.82s)
=== RUN   TestAccComputeBackendService_basic
--- PASS: TestAccComputeBackendService_basic (66.33s)
=== RUN   TestAccComputeBackendService_withBackend
--- PASS: TestAccComputeBackendService_withBackend (91.32s)
=== RUN   TestAccComputeBackendService_withBackendAndUpdate
--- PASS: TestAccComputeBackendService_withBackendAndUpdate (113.24s)
=== RUN   TestAccComputeBackendService_updatePreservesOptionalParameters
--- PASS: TestAccComputeBackendService_updatePreservesOptionalParameters (54.94s)
=== RUN   TestAccComputeBackendService_withConnectionDraining
--- PASS: TestAccComputeBackendService_withConnectionDraining (43.62s)
=== RUN   TestAccComputeBackendService_withConnectionDrainingAndUpdate
--- PASS: TestAccComputeBackendService_withConnectionDrainingAndUpdate (55.09s)
=== RUN   TestAccComputeBackendService_withHttpsHealthCheck
--- PASS: TestAccComputeBackendService_withHttpsHealthCheck (43.17s)
=== RUN   TestAccComputeBackendService_withCDNEnabled
--- PASS: TestAccComputeBackendService_withCDNEnabled (43.51s)
=== RUN   TestAccComputeBackendService_withSessionAffinity
--- PASS: TestAccComputeBackendService_withSessionAffinity (55.01s)
PASS
ok  	github.com/terraform-providers/terraform-provider-google/google	611.229s

@danawillow
Copy link
Contributor Author

(not actually looking for 3 reviews, just whichever of you get to it first)

Copy link
Contributor

@paddycarver paddycarver left a 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")
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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?

Copy link
Contributor

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. :)

@danawillow danawillow merged commit ea909a3 into hashicorp:master Oct 12, 2017
@danawillow danawillow deleted the bsgroup branch October 12, 2017 16:21
negz pushed a commit to negz/terraform-provider-google that referenced this pull request Oct 17, 2017
negz pushed a commit to negz/terraform-provider-google that referenced this pull request Oct 17, 2017
luis-silva pushed a commit to luis-silva/terraform-provider-google that referenced this pull request May 21, 2019
)

<!-- This change is generated by MagicModules. -->
/cc @rileykarson
@ghost
Copy link

ghost commented Mar 30, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants