Skip to content

Commit 435e0c7

Browse files
Remove instance_group_urls (#5378) (#10442)
Signed-off-by: Modular Magician <[email protected]>
1 parent c1f9917 commit 435e0c7

7 files changed

+9
-49
lines changed

.changelog/5378.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:breaking-change
2+
container: `instance_group_urls` has been removed in favor of `node_pool.instance_group_urls`
3+
```

google/resource_compute_instance_group_named_port_generated_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ func TestAccComputeInstanceGroupNamedPort_instanceGroupNamedPortGkeExample(t *te
5252
func testAccComputeInstanceGroupNamedPort_instanceGroupNamedPortGkeExample(context map[string]interface{}) string {
5353
return Nprintf(`
5454
resource "google_compute_instance_group_named_port" "my_port" {
55-
group = google_container_cluster.my_cluster.instance_group_urls[0]
55+
group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0]
5656
zone = "us-central1-a"
5757
5858
name = "http"
5959
port = 8080
6060
}
6161
6262
resource "google_compute_instance_group_named_port" "my_ports" {
63-
group = google_container_cluster.my_cluster.instance_group_urls[0]
63+
group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0]
6464
zone = "us-central1-a"
6565
6666
name = "https"

google/resource_container_cluster.go

-40
Original file line numberDiff line numberDiff line change
@@ -704,14 +704,6 @@ func resourceContainerCluster() *schema.Resource {
704704
Description: `The IP address of this cluster's Kubernetes master.`,
705705
},
706706

707-
"instance_group_urls": {
708-
Type: schema.TypeList,
709-
Computed: true,
710-
Deprecated: `Please use node_pool.instance_group_urls instead.`,
711-
Elem: &schema.Schema{Type: schema.TypeString},
712-
Description: `List of instance group URLs which have been assigned to the cluster.`,
713-
},
714-
715707
"master_version": {
716708
Type: schema.TypeString,
717709
Computed: true,
@@ -1559,14 +1551,6 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
15591551
return err
15601552
}
15611553

1562-
igUrls, err := getInstanceGroupUrlsFromManagerUrls(config, userAgent, cluster.InstanceGroupUrls)
1563-
if err != nil {
1564-
return err
1565-
}
1566-
if err := d.Set("instance_group_urls", igUrls); err != nil {
1567-
return err
1568-
}
1569-
15701554
if err := d.Set("vertical_pod_autoscaling", flattenVerticalPodAutoscaling(cluster.VerticalPodAutoscaling)); err != nil {
15711555
return err
15721556
}
@@ -2490,30 +2474,6 @@ func containerClusterAwaitRestingState(config *Config, project, location, cluste
24902474
return state, err
24912475
}
24922476

2493-
// container engine's API returns the instance group manager's URL instead of the instance
2494-
// group's URL in its responses, while the field is named as if it should have been the group
2495-
// and not the manager. This shim should be supported for backwards compatibility reasons.
2496-
func getInstanceGroupUrlsFromManagerUrls(config *Config, userAgent string, igmUrls []string) ([]string, error) {
2497-
instanceGroupURLs := make([]string, 0, len(igmUrls))
2498-
for _, u := range igmUrls {
2499-
if !instanceGroupManagerURL.MatchString(u) {
2500-
instanceGroupURLs = append(instanceGroupURLs, u)
2501-
continue
2502-
}
2503-
matches := instanceGroupManagerURL.FindStringSubmatch(u)
2504-
instanceGroupManager, err := config.NewComputeClient(userAgent).InstanceGroupManagers.Get(matches[1], matches[2], matches[3]).Do()
2505-
if isGoogleApiErrorWithCode(err, 404) {
2506-
// The IGM URL is stale; don't include it
2507-
continue
2508-
}
2509-
if err != nil {
2510-
return nil, fmt.Errorf("Error reading instance group manager returned as an instance group URL: %s", err)
2511-
}
2512-
instanceGroupURLs = append(instanceGroupURLs, instanceGroupManager.InstanceGroup)
2513-
}
2514-
return instanceGroupURLs, nil
2515-
}
2516-
25172477
func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
25182478
l := configured.([]interface{})
25192479
if len(l) == 0 || l[0] == nil {

google/resource_container_cluster_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2567,7 +2567,7 @@ resource "google_compute_backend_service" "my-backend-service" {
25672567
protocol = "HTTP"
25682568
25692569
backend {
2570-
group = element(google_container_cluster.primary.instance_group_urls, 1)
2570+
group = element(google_container_cluster.primary.node_pool[0].instance_group_urls, 1)
25712571
}
25722572
25732573
health_checks = [google_compute_http_health_check.default.self_link]

website/docs/d/container_cluster.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ output "endpoint" {
2424
}
2525
2626
output "instance_group_urls" {
27-
value = data.google_container_cluster.my_cluster.instance_group_urls
27+
value = data.google_container_cluster.my_cluster.node_pool[0].instance_group_urls
2828
}
2929
3030
output "node_config" {

website/docs/r/compute_instance_group_named_port.html.markdown

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ To get more information about InstanceGroupNamedPort, see:
4545

4646
```hcl
4747
resource "google_compute_instance_group_named_port" "my_port" {
48-
group = google_container_cluster.my_cluster.instance_group_urls[0]
48+
group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0]
4949
zone = "us-central1-a"
5050
5151
name = "http"
5252
port = 8080
5353
}
5454
5555
resource "google_compute_instance_group_named_port" "my_ports" {
56-
group = google_container_cluster.my_cluster.instance_group_urls[0]
56+
group = google_container_cluster.my_cluster.node_pool[0].instance_group_urls[0]
5757
zone = "us-central1-a"
5858
5959
name = "https"

website/docs/r/container_cluster.html.markdown

-3
Original file line numberDiff line numberDiff line change
@@ -925,9 +925,6 @@ exported:
925925

926926
* `endpoint` - The IP address of this cluster's Kubernetes master.
927927

928-
* `instance_group_urls` - List of instance group URLs which have been assigned
929-
to the cluster.
930-
931928
* `label_fingerprint` - The fingerprint of the set of labels for this cluster.
932929

933930
* `maintenance_policy.0.daily_maintenance_window.0.duration` - Duration of the time window, automatically chosen to be

0 commit comments

Comments
 (0)