Skip to content

Commit a78fae5

Browse files
Make GKE cluster enable_l4_ilb_subsetting a computed field (#15814) (#25323)
[upstream:15dc2c7b091a80f10c77c2388527a44997a4889a] Signed-off-by: Modular Magician <[email protected]>
1 parent 5f42fa1 commit a78fae5

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

.changelog/15814.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
unknown: Make GKE cluster enable_l4_ilb_subsetting a computed field

google/services/container/resource_container_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,8 +2148,8 @@ func ResourceContainerCluster() *schema.Resource {
21482148
"enable_l4_ilb_subsetting": {
21492149
Type: schema.TypeBool,
21502150
Optional: true,
2151+
Computed: true,
21512152
Description: `Whether L4ILB Subsetting is enabled for this cluster.`,
2152-
Default: false,
21532153
},
21542154
"disable_l4_lb_firewall_reconciliation": {
21552155
Type: schema.TypeBool,

google/services/container/resource_container_cluster_test.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,50 @@ func TestAccContainerCluster_withILBSubsetting(t *testing.T) {
637637
})
638638
}
639639

640+
func TestAccContainerCluster_omittedILBSubsetting(t *testing.T) {
641+
t.Parallel()
642+
643+
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
644+
npName := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10))
645+
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
646+
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
647+
648+
acctest.VcrTest(t, resource.TestCase{
649+
PreCheck: func() { acctest.AccTestPreCheck(t) },
650+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
651+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
652+
Steps: []resource.TestStep{
653+
{
654+
Config: testAccContainerCluster_omittedILBSubSetting(clusterName, npName, networkName, subnetworkName),
655+
},
656+
{
657+
ResourceName: "google_container_cluster.confidential_nodes",
658+
ImportState: true,
659+
ImportStateVerify: true,
660+
ImportStateVerifyIgnore: []string{"deletion_protection"},
661+
},
662+
{
663+
Config: testAccContainerCluster_withILBSubSetting(clusterName, npName, networkName, subnetworkName),
664+
},
665+
{
666+
ResourceName: "google_container_cluster.confidential_nodes",
667+
ImportState: true,
668+
ImportStateVerify: true,
669+
ImportStateVerifyIgnore: []string{"deletion_protection"},
670+
},
671+
{
672+
Config: testAccContainerCluster_omittedILBSubSetting(clusterName, npName, networkName, subnetworkName),
673+
},
674+
{
675+
ResourceName: "google_container_cluster.confidential_nodes",
676+
ImportState: true,
677+
ImportStateVerify: true,
678+
ImportStateVerifyIgnore: []string{"deletion_protection"},
679+
},
680+
},
681+
})
682+
}
683+
640684
func TestAccContainerCluster_disableL4LbFirewallReconciliation(t *testing.T) {
641685
t.Parallel()
642686

@@ -7320,6 +7364,33 @@ resource "google_container_cluster" "confidential_nodes" {
73207364
`, clusterName, npName, networkName, subnetworkName)
73217365
}
73227366

7367+
func testAccContainerCluster_omittedILBSubSetting(clusterName, npName, networkName, subnetworkName string) string {
7368+
return fmt.Sprintf(`
7369+
resource "google_container_cluster" "confidential_nodes" {
7370+
name = "%s"
7371+
location = "us-central1-a"
7372+
release_channel {
7373+
channel = "RAPID"
7374+
}
7375+
7376+
node_pool {
7377+
name = "%s"
7378+
initial_node_count = 1
7379+
node_config {
7380+
machine_type = "e2-medium"
7381+
}
7382+
}
7383+
7384+
// enable_l4_ilb_subsetting omitted
7385+
7386+
network = "%s"
7387+
subnetwork = "%s"
7388+
7389+
deletion_protection = false
7390+
}
7391+
`, clusterName, npName, networkName, subnetworkName)
7392+
}
7393+
73237394
func testAccContainerCluster_disableILBSubSetting(clusterName, npName, networkName, subnetworkName string) string {
73247395
return fmt.Sprintf(`
73257396
resource "google_container_cluster" "confidential_nodes" {

0 commit comments

Comments
 (0)