diff --git a/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.erb b/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.erb index 5e2279017ebd..3a4b492eca8a 100644 --- a/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.erb +++ b/mmv1/templates/terraform/examples/instance_group_named_port_gke.tf.erb @@ -1,5 +1,5 @@ resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_id] %>" { - group = google_container_cluster.my_cluster.instance_group_urls[0] + group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0] zone = "us-central1-a" name = "http" @@ -7,7 +7,7 @@ resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_i } resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_id] %>s" { - group = google_container_cluster.my_cluster.instance_group_urls[0] + group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0] zone = "us-central1-a" name = "https" diff --git a/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb b/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb index a019006b715a..8deb4bc728dd 100644 --- a/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb @@ -960,14 +960,6 @@ func resourceContainerCluster() *schema.Resource { Description: `The IP address of this cluster's Kubernetes master.`, }, - "instance_group_urls": { - Type: schema.TypeList, - Computed: true, - Deprecated: `Please use node_pool.instance_group_urls instead.`, - Elem: &schema.Schema{Type: schema.TypeString}, - Description: `List of instance group URLs which have been assigned to the cluster.`, - }, - "master_version": { Type: schema.TypeString, Computed: true, @@ -1904,14 +1896,6 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro return err } - igUrls, err := getInstanceGroupUrlsFromManagerUrls(config, userAgent, cluster.InstanceGroupUrls) - if err != nil { - return err - } - if err := d.Set("instance_group_urls", igUrls); err != nil { - return err - } - if err := d.Set("vertical_pod_autoscaling", flattenVerticalPodAutoscaling(cluster.VerticalPodAutoscaling)); err != nil { return err } @@ -3025,30 +3009,6 @@ func containerClusterAwaitRestingState(config *Config, project, location, cluste return state, err } -// container engine's API returns the instance group manager's URL instead of the instance -// group's URL in its responses, while the field is named as if it should have been the group -// and not the manager. This shim should be supported for backwards compatibility reasons. -func getInstanceGroupUrlsFromManagerUrls(config *Config, userAgent string, igmUrls []string) ([]string, error) { - instanceGroupURLs := make([]string, 0, len(igmUrls)) - for _, u := range igmUrls { - if !instanceGroupManagerURL.MatchString(u) { - instanceGroupURLs = append(instanceGroupURLs, u) - continue - } - matches := instanceGroupManagerURL.FindStringSubmatch(u) - instanceGroupManager, err := config.NewComputeClient(userAgent).InstanceGroupManagers.Get(matches[1], matches[2], matches[3]).Do() - if isGoogleApiErrorWithCode(err, 404) { - // The IGM URL is stale; don't include it - continue - } - if err != nil { - return nil, fmt.Errorf("Error reading instance group manager returned as an instance group URL: %s", err) - } - instanceGroupURLs = append(instanceGroupURLs, instanceGroupManager.InstanceGroup) - } - return instanceGroupURLs, nil -} - func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig { l := configured.([]interface{}) if len(l) == 0 || l[0] == nil { diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 3a54ac5fc568..1ade1b6f74c9 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -3386,7 +3386,7 @@ resource "google_compute_backend_service" "my-backend-service" { protocol = "HTTP" backend { - group = element(google_container_cluster.primary.instance_group_urls, 1) + group = element(google_container_cluster.primary.node_pool[0].instance_group_urls, 1) } health_checks = [google_compute_http_health_check.default.self_link] diff --git a/mmv1/third_party/terraform/website/docs/d/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/d/container_cluster.html.markdown index c03e9341260e..851655d2fc74 100644 --- a/mmv1/third_party/terraform/website/docs/d/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/container_cluster.html.markdown @@ -32,7 +32,7 @@ output "endpoint" { } output "instance_group_urls" { - value = data.google_container_cluster.my_cluster.instance_group_urls + value = data.google_container_cluster.my_cluster.node_pool[0].instance_group_urls } output "node_config" { diff --git a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown index d9b5e5268f33..7a06f2b33761 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -931,9 +931,6 @@ exported: * `endpoint` - The IP address of this cluster's Kubernetes master. -* `instance_group_urls` - List of instance group URLs which have been assigned - to the cluster. - * `label_fingerprint` - The fingerprint of the set of labels for this cluster. * `maintenance_policy.0.daily_maintenance_window.0.duration` - Duration of the time window, automatically chosen to be