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

Fix failing container cluster tests #11986

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6189.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
container: fixed an issue where `node_config.min_cpu_platform` could cause a perma-diff in `google_container_cluster`
```
1 change: 1 addition & 0 deletions google/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func schemaNodeConfig() *schema.Schema {
"min_cpu_platform": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: `Minimum CPU platform to be used by this instance. The instance may be scheduled on the specified or newer CPU platform.`,
},
Expand Down
94 changes: 49 additions & 45 deletions google/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,16 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
{
Config: testAccContainerCluster_withInternalLoadBalancer(pid, clusterName),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version"},
},
// Issue with cloudrun_config addon: https://github.com/hashicorp/terraform-provider-google/issues/11943
// {
// Config: testAccContainerCluster_withInternalLoadBalancer(pid, clusterName),
// },
// {
// ResourceName: "google_container_cluster.primary",
// ImportState: true,
// ImportStateVerify: true,
// ImportStateVerifyIgnore: []string{"min_master_version"},
// },
},
})
}
Expand Down Expand Up @@ -2417,7 +2418,9 @@ resource "google_container_cluster" "primary" {
enabled = true
}
cloudrun_config {
disabled = false
# https://github.com/hashicorp/terraform-provider-google/issues/11943
# disabled = false
disabled = true
}
dns_cache_config {
enabled = true
Expand All @@ -2427,41 +2430,42 @@ resource "google_container_cluster" "primary" {
`, projectID, clusterName)
}

func testAccContainerCluster_withInternalLoadBalancer(projectID string, clusterName string) string {
return fmt.Sprintf(`
data "google_project" "project" {
project_id = "%s"
}

resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1

min_master_version = "latest"

workload_identity_config {
workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
}

addons_config {
http_load_balancing {
disabled = false
}
horizontal_pod_autoscaling {
disabled = false
}
network_policy_config {
disabled = false
}
cloudrun_config {
disabled = false
load_balancer_type = "LOAD_BALANCER_TYPE_INTERNAL"
}
}
}
`, projectID, clusterName)
}
// Issue with cloudrun_config addon: https://github.com/hashicorp/terraform-provider-google/issues/11943/
// func testAccContainerCluster_withInternalLoadBalancer(projectID string, clusterName string) string {
// return fmt.Sprintf(`
// data "google_project" "project" {
// project_id = "%s"
// }

// resource "google_container_cluster" "primary" {
// name = "%s"
// location = "us-central1-a"
// initial_node_count = 1

// min_master_version = "latest"

// workload_identity_config {
// workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
// }

// addons_config {
// http_load_balancing {
// disabled = false
// }
// horizontal_pod_autoscaling {
// disabled = false
// }
// network_policy_config {
// disabled = false
// }
// cloudrun_config {
// disabled = false
// load_balancer_type = "LOAD_BALANCER_TYPE_INTERNAL"
// }
// }
// }
// `, projectID, clusterName)
// }

func testAccContainerCluster_withNotificationConfig(clusterName string, topic string) string {
return fmt.Sprintf(`
Expand Down