Skip to content

Commit

Permalink
Update resource_container_cluster_test.go.erb
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayimeow authored Oct 31, 2023
1 parent 36327bb commit 658d28c
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4230,6 +4230,45 @@ func TestAccContainerCluster_withSecurityPostureConfig(t *testing.T) {
})
}

func TestAccContainerCluster_withFleetConfig(t *testing.T) {
t.Parallel()

clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
projectID := envvar.GetTestProjectFromEnv()

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccContainerCluster_withFleetConfig(clusterName, projectID),
},
{
ResourceName: "google_container_cluster.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
},
},
})
}

func testAccContainerCluster_withFleetConfig(name, projectID string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "primary" {
name = "%s"
location = "us-central1-a"
initial_node_count = 1

fleet {
project = "%s"
}
deletion_protection = false
}
`, name, projectID)
}

func testAccContainerCluster_SetSecurityPostureToStandard(resource_name, networkName, subnetworkName string) string {
return fmt.Sprintf(`
resource "google_container_cluster" "with_security_posture_config" {
Expand Down Expand Up @@ -9130,3 +9169,4 @@ resource "google_container_cluster" "without_confidential_boot_disk" {
`, clusterName, npName)
}
<% end -%>

0 comments on commit 658d28c

Please sign in to comment.