Skip to content

Commit 5eb5d67

Browse files
authored
Add membership_type field to cluster/fleet (#15221)
1 parent 03e521b commit 5eb5d67

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,12 @@ func ResourceContainerCluster() *schema.Resource {
24502450
Computed: true,
24512451
Description: `Location of the fleet membership, for example "us-central1".`,
24522452
},
2453+
"membership_type": {
2454+
Type: schema.TypeString,
2455+
Optional: true,
2456+
ValidateFunc: validation.StringInSlice([]string{"LIGHTWEIGHT"}, false),
2457+
Description: `The type of the cluster's fleet membership.`,
2458+
},
24532459
},
24542460
},
24552461
},
@@ -6570,6 +6576,7 @@ func expandFleet(configured interface{}) *container.Fleet {
65706576
config := l[0].(map[string]interface{})
65716577
return &container.Fleet{
65726578
Project: config["project"].(string),
6579+
MembershipType: config["membership_type"].(string),
65736580
}
65746581
}
65756582

@@ -7680,6 +7687,7 @@ func flattenFleet(c *container.Fleet) []map[string]interface{} {
76807687
"membership_id": membership_id,
76817688
"membership_location": membership_location,
76827689
"pre_registered": c.PreRegistered,
7690+
"membership_type": c.MembershipType,
76837691
},
76847692
}
76857693
}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5863,6 +5863,15 @@ func TestAccContainerCluster_withFleetConfig(t *testing.T) {
58635863
ImportStateVerify: true,
58645864
ImportStateVerifyIgnore: []string{"deletion_protection"},
58655865
},
5866+
{
5867+
Config: testAccContainerCluster_withFleetConfigLightweightMembership(clusterName, projectID, networkName, subnetworkName),
5868+
},
5869+
{
5870+
ResourceName: "google_container_cluster.primary",
5871+
ImportState: true,
5872+
ImportStateVerify: true,
5873+
ImportStateVerifyIgnore: []string{"deletion_protection"},
5874+
},
58665875
},
58675876
})
58685877
}
@@ -5989,6 +5998,26 @@ resource "google_container_cluster" "primary" {
59895998
`, resource_name, networkName, subnetworkName)
59905999
}
59916000

6001+
func testAccContainerCluster_withFleetConfigLightweightMembership(name, projectID, networkName, subnetworkName string) string {
6002+
return fmt.Sprintf(`
6003+
resource "google_container_cluster" "primary" {
6004+
name = "%s"
6005+
location = "us-central1-a"
6006+
initial_node_count = 1
6007+
6008+
fleet {
6009+
project = "%s"
6010+
membership_type = "LIGHTWEIGHT"
6011+
}
6012+
6013+
network = "%s"
6014+
subnetwork = "%s"
6015+
6016+
deletion_protection = false
6017+
}
6018+
`, name, projectID, networkName, subnetworkName)
6019+
}
6020+
59926021
func testAccContainerCluster_withIncompatibleMasterVersionNodeVersion(name, networkName, subnetworkName string) string {
59936022
return fmt.Sprintf(`
59946023
resource "google_container_cluster" "gke_cluster" {

mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,8 @@ linux_node_config {
16621662

16631663
* `project` - (Optional) The name of the Fleet host project where this cluster will be registered.
16641664

1665+
* `membership_type` - (Optional) Sets the membership type of the cluster. Available option is `LIGHTWEIGHT` to support only lightweight compatible features. If unspecified, the membership_type will be a regular membership that supports all features.
1666+
16651667
<a name="nested_workload_alts_config"></a>The `workload_alts_config` block supports:
16661668

16671669
* `enable_alts` - (Required) Whether the alts handshaker should be enabled or not for direct-path. Requires Workload Identity ([workloadPool]((#nested_workload_identity_config)) must be non-empty).

0 commit comments

Comments
 (0)