Skip to content

Commit de83a69

Browse files
authored
container: re-enable LB step in TestAccContainerCluster_withAddons (#12098)
1 parent a3c4547 commit de83a69

File tree

1 file changed

+68
-68
lines changed

1 file changed

+68
-68
lines changed

mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl

+68-68
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
201201
pid := envvar.GetTestProjectFromEnv()
202202

203203
acctest.VcrTest(t, resource.TestCase{
204-
PreCheck: func() { acctest.AccTestPreCheck(t) },
204+
PreCheck: func() { acctest.AccTestPreCheck(t) },
205205
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
206-
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
206+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
207207
Steps: []resource.TestStep{
208208
{
209209
Config: testAccContainerCluster_withAddons(pid, clusterName, networkName, subnetworkName),
@@ -212,7 +212,6 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
212212
ResourceName: "google_container_cluster.primary",
213213
ImportState: true,
214214
ImportStateVerify: true,
215-
// TODO: clean up this list in `4.0.0`, remove both `workload_identity_config` fields (same for below)
216215
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
217216
},
218217
{
@@ -224,16 +223,15 @@ func TestAccContainerCluster_withAddons(t *testing.T) {
224223
ImportStateVerify: true,
225224
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
226225
},
227-
// Issue with cloudrun_config addon: https://github.com/hashicorp/terraform-provider-google/issues/11943
228-
// {
229-
// Config: testAccContainerCluster_withInternalLoadBalancer(pid, clusterName, networkName, subnetworkName),
230-
// },
231-
// {
232-
// ResourceName: "google_container_cluster.primary",
233-
// ImportState: true,
234-
// ImportStateVerify: true,
235-
// ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
236-
// },
226+
{
227+
Config: testAccContainerCluster_withInternalLoadBalancer(pid, clusterName, networkName, subnetworkName),
228+
},
229+
{
230+
ResourceName: "google_container_cluster.primary",
231+
ImportState: true,
232+
ImportStateVerify: true,
233+
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
234+
},
237235
},
238236
})
239237
}
@@ -5793,12 +5791,12 @@ resource "google_container_cluster" "primary" {
57935791
gce_persistent_disk_csi_driver_config {
57945792
enabled = false
57955793
}
5796-
gke_backup_agent_config {
5797-
enabled = false
5798-
}
5799-
config_connector_config {
5800-
enabled = false
5801-
}
5794+
gke_backup_agent_config {
5795+
enabled = false
5796+
}
5797+
config_connector_config {
5798+
enabled = false
5799+
}
58025800
gcs_fuse_csi_driver_config {
58035801
enabled = false
58045802
}
@@ -5818,9 +5816,10 @@ resource "google_container_cluster" "primary" {
58185816
}
58195817
{{- end }}
58205818
}
5821-
deletion_protection = false
58225819
network = "%s"
5823-
subnetwork = "%s"
5820+
subnetwork = "%s"
5821+
5822+
deletion_protection = false
58245823
}
58255824
`, projectID, clusterName, networkName, subnetworkName)
58265825
}
@@ -5866,12 +5865,12 @@ resource "google_container_cluster" "primary" {
58665865
gce_persistent_disk_csi_driver_config {
58675866
enabled = true
58685867
}
5869-
gke_backup_agent_config {
5870-
enabled = true
5871-
}
5872-
config_connector_config {
5873-
enabled = true
5874-
}
5868+
gke_backup_agent_config {
5869+
enabled = true
5870+
}
5871+
config_connector_config {
5872+
enabled = true
5873+
}
58755874
gcs_fuse_csi_driver_config {
58765875
enabled = true
58775876
}
@@ -5897,52 +5896,53 @@ resource "google_container_cluster" "primary" {
58975896
}
58985897
{{- end }}
58995898
}
5900-
deletion_protection = false
59015899
network = "%s"
5902-
subnetwork = "%s"
5900+
subnetwork = "%s"
5901+
5902+
deletion_protection = false
59035903
}
59045904
`, projectID, clusterName, networkName, subnetworkName)
59055905
}
59065906

5907-
// Issue with cloudrun_config addon: https://github.com/hashicorp/terraform-provider-google/issues/11943/
5908-
// func testAccContainerCluster_withInternalLoadBalancer(projectID string, clusterName, networkName, subnetworkName string) string {
5909-
// return fmt.Sprintf(`
5910-
// data "google_project" "project" {
5911-
// project_id = "%s"
5912-
// }
5913-
5914-
// resource "google_container_cluster" "primary" {
5915-
// name = "%s"
5916-
// location = "us-central1-a"
5917-
// initial_node_count = 1
5918-
5919-
// min_master_version = "latest"
5920-
5921-
// workload_identity_config {
5922-
// workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
5923-
// }
5924-
5925-
// addons_config {
5926-
// http_load_balancing {
5927-
// disabled = false
5928-
// }
5929-
// horizontal_pod_autoscaling {
5930-
// disabled = false
5931-
// }
5932-
// network_policy_config {
5933-
// disabled = false
5934-
// }
5935-
// cloudrun_config {
5936-
// disabled = false
5937-
// load_balancer_type = "LOAD_BALANCER_TYPE_INTERNAL"
5938-
// }
5939-
// }
5940-
// deletion_protection = false
5941-
// network = "%s"
5942-
// subnetwork = "%s"
5943-
// }
5944-
// `, projectID, clusterName, networkName, subnetworkName)
5945-
// }
5907+
func testAccContainerCluster_withInternalLoadBalancer(projectID string, clusterName, networkName, subnetworkName string) string {
5908+
return fmt.Sprintf(`
5909+
data "google_project" "project" {
5910+
project_id = "%s"
5911+
}
5912+
5913+
resource "google_container_cluster" "primary" {
5914+
name = "%s"
5915+
location = "us-central1-a"
5916+
initial_node_count = 1
5917+
5918+
min_master_version = "latest"
5919+
5920+
workload_identity_config {
5921+
workload_pool = "${data.google_project.project.project_id}.svc.id.goog"
5922+
}
5923+
5924+
addons_config {
5925+
http_load_balancing {
5926+
disabled = false
5927+
}
5928+
horizontal_pod_autoscaling {
5929+
disabled = false
5930+
}
5931+
network_policy_config {
5932+
disabled = false
5933+
}
5934+
cloudrun_config {
5935+
disabled = false
5936+
load_balancer_type = "LOAD_BALANCER_TYPE_INTERNAL"
5937+
}
5938+
}
5939+
network = "%s"
5940+
subnetwork = "%s"
5941+
5942+
deletion_protection = false
5943+
}
5944+
`, projectID, clusterName, networkName, subnetworkName)
5945+
}
59465946

59475947
func testAccContainerCluster_withNotificationConfig(clusterName, topic, networkName, subnetworkName string) string {
59485948
return fmt.Sprintf(`

0 commit comments

Comments
 (0)