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

provider/google: Add google_compute_zones data source #11954

Merged
merged 1 commit into from
Feb 15, 2017

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Feb 15, 2017

I wanted to build a GKE cluster and I saw hard-coded zones in the example which is what prompted me to write this data source in the 1st place.

There are some HCL changes that would help making this more elegant/useful though, specifically slicing lists via colon, e.g.

zone = "${data.google_compute_zones.available.names[0]}"
additional_zones = [
    "${data.google_compute_zones.available.names[1:]}"
]

Test plan

make testacc TEST=./builtin/providers/google TESTARGS='-run=TestAccGoogleComputeZones_basic'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/15 07:33:15 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/google -v -run=TestAccGoogleComputeZones_basic -timeout 120m
=== RUN   TestAccGoogleComputeZones_basic
--- PASS: TestAccGoogleComputeZones_basic (3.05s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/google	3.079s

Copy link
Contributor

@stack72 stack72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 small question but LGTM!

if r, ok := d.GetOk("region"); ok {
region = r.(string)
}
projectBaseUrl := "https://www.googleapis.com/compute/v1/projects/" + config.Project
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be done using fmt.Sprintf rather than concatenation? I am not sure which is the right way to do it TBH

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sure, why not... I will change it

@radeksimko radeksimko force-pushed the f-google-compute-zones branch from 5a3e68f to c40b0de Compare February 15, 2017 09:47
@radeksimko radeksimko force-pushed the f-google-compute-zones branch from c40b0de to 76c40ac Compare February 15, 2017 09:50
@radeksimko
Copy link
Member Author

@stack72 Updated

@stack72
Copy link
Contributor

stack72 commented Feb 15, 2017

LGTM!

@radeksimko radeksimko merged commit 0e8997f into master Feb 15, 2017
@radeksimko radeksimko deleted the f-google-compute-zones branch February 15, 2017 10:00
radeksimko added a commit that referenced this pull request Feb 15, 2017
provider/google: Add google_compute_zones data source
@ghost
Copy link

ghost commented Apr 16, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

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

Successfully merging this pull request may close these issues.

2 participants