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

Issue 43: Fix issue with single zone, and update test for the problem. #50

Merged
merged 13 commits into from
Jan 8, 2019
Merged
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ locals {
}

cluster_type_output_regional_zones = "${concat(google_container_cluster.primary.*.additional_zones, list(list()))}"
cluster_type_output_zonal_zones = "${concat(google_container_cluster.zonal_primary.*.additional_zones, list(list()))}"
cluster_type_output_zonal_zones = "${concat(slice(var.zones,1,length(var.zones)), list(list()))}"
Copy link
Author

Choose a reason for hiding this comment

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

This is the relevant change

Choose a reason for hiding this comment

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

For my own understanding, is the issue google_container_cluster.zonal_primary.*.additional_zones sometimes resolves to null instead of a list?

Choose a reason for hiding this comment

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

For my own understanding, is the issue google_container_cluster.zonal_primary.*.additional_zones sometimes resolves to null instead of a list?

Ah, I was able to clarify my understanding back in the bug report in #43

Error: Error running plan: 1 error(s) occurred:

* module.gke.local.cluster_type_output_zonal_zones: local.cluster_type_output_zonal_zones: Resource 'google_container_cluster.zonal_primary' does not have attribute 'additional_zones' for variable 'google_container_cluster.zonal_primary.*.additional_zones'

Copy link
Author

Choose a reason for hiding this comment

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

Yep, that's exactly right. When there's no additional zones, the provider returns null, which breaks that logic.


cluster_type_output_zones = {
regional = "${local.cluster_type_output_regional_zones[0]}"
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/simple_zonal/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module "example" {
project_id = "${var.project_id}"
credentials_path = "${local.credentials_path}"
region = "${var.region}"
zones = ["${var.zones}"]
zones = ["${slice(var.zones,1,1)}"]
network = "${google_compute_network.main.name}"
subnetwork = "${google_compute_subnetwork.main.name}"
ip_range_pods = "${google_compute_subnetwork.main.secondary_ip_range.0.range_name}"
Expand Down
4 changes: 4 additions & 0 deletions test/integration/simple_zonal/controls/gcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
expect(data['location']).to match(/^(.*)[1-9]-[a-z]$/)
end

it "is single zoned" do
expect(data['locations'].size).to eq 1
end

it "has the expected initial cluster version" do
expect(data['initialClusterVersion']).to eq "1.11.4-gke.13"
end
Expand Down