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

promote node_pool_auto_config field to GA provider #8951

Merged
merged 1 commit into from
Sep 18, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,6 @@ func ResourceContainerCluster() *schema.Resource {

"node_pool_defaults": clusterSchemaNodePoolDefaults(),

<% unless version == "ga" -%>
"node_pool_auto_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -1431,7 +1430,6 @@ func ResourceContainerCluster() *schema.Resource {
},
},
},
<% end -%>

"node_version": {
Type: schema.TypeString,
Expand Down Expand Up @@ -2182,8 +2180,8 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
NotificationConfig: expandNotificationConfig(d.Get("notification_config")),
ConfidentialNodes: expandConfidentialNodes(d.Get("confidential_nodes")),
ResourceLabels: tpgresource.ExpandStringMap(d, "resource_labels"),
<% unless version == 'ga' -%>
NodePoolAutoConfig: expandNodePoolAutoConfig(d.Get("node_pool_auto_config")),
<% unless version == 'ga' -%>
ProtectConfig: expandProtectConfig(d.Get("protect_config")),
<% end -%>
CostManagementConfig: expandCostManagementConfig(d.Get("cost_management_config")),
Expand Down Expand Up @@ -2318,11 +2316,9 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
cluster.MonitoringConfig = expandMonitoringConfig(v)
}

<% unless version == 'ga' -%>
if err := validateNodePoolAutoConfig(cluster); err != nil {
return err
}
<% end -%>

if err := validatePrivateClusterConfig(cluster); err != nil {
return err
Expand Down Expand Up @@ -2807,11 +2803,9 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
return err
}

<% unless version == 'ga' -%>
if err := d.Set("node_pool_auto_config", flattenNodePoolAutoConfig(cluster.NodePoolAutoConfig)); err != nil {
return err
}
<% end -%>

if err := d.Set("node_pool_defaults", flattenNodePoolDefaults(cluster.NodePoolDefaults)); err != nil {
return err
Expand Down Expand Up @@ -4018,7 +4012,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
log.Printf("[INFO] GKE cluster %s Security Posture Config has been updated to %#v", d.Id(), req.Update.DesiredSecurityPostureConfig)
}

<% unless version == 'ga' -%>
if d.HasChange("node_pool_auto_config.0.network_tags.0.tags") {
tags := d.Get("node_pool_auto_config.0.network_tags.0.tags").([]interface{})

Expand All @@ -4039,7 +4032,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er

log.Printf("[INFO] GKE cluster %s node pool auto config network tags have been updated", d.Id())
}
<% end -%>

d.Partial(false)

Expand Down Expand Up @@ -5298,7 +5290,6 @@ func flattenNodePoolDefaults(c *container.NodePoolDefaults) []map[string]interfa
return []map[string]interface{}{result}
}

<% unless version == 'ga' -%>
func expandNodePoolAutoConfig(configured interface{}) *container.NodePoolAutoConfig {
l := configured.([]interface{})
if len(l) == 0 || l[0] == nil {
Expand Down Expand Up @@ -5326,7 +5317,6 @@ func expandNodePoolAutoConfigNetworkTags(configured interface{}) *container.Netw
}
return nt
}
<% end -%>

func flattenNotificationConfig(c *container.NotificationConfig) []map[string]interface{} {
if c == nil {
Expand Down Expand Up @@ -6052,7 +6042,6 @@ func flattenManagedPrometheusConfig(c *container.ManagedPrometheusConfig) []map[
}
}

<% unless version == 'ga' -%>
func flattenNodePoolAutoConfig(c *container.NodePoolAutoConfig) []map[string]interface{} {
if c == nil {
return nil
Expand All @@ -6077,7 +6066,6 @@ func flattenNodePoolAutoConfigNetworkTags(c *container.NetworkTags) []map[string
}
return []map[string]interface{}{result}
}
<% end -%>

func resourceContainerClusterStateImporter(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
config := meta.(*transport_tpg.Config)
Expand Down Expand Up @@ -6301,7 +6289,6 @@ func BinaryAuthorizationDiffSuppress(k, old, new string, r *schema.ResourceData)
return false
}

<% unless version == 'ga' -%>
func validateNodePoolAutoConfig(cluster *container.Cluster) error {
if cluster == nil || cluster.NodePoolAutoConfig == nil {
return nil
Expand All @@ -6314,7 +6301,6 @@ func validateNodePoolAutoConfig(cluster *container.Cluster) error {

return nil
}
<% end -%>

func containerClusterSurgeSettingsCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error {
if v, ok := d.GetOk("cluster_autoscaling.0.auto_provisioning_defaults.0.upgrade_settings.0.strategy"); ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2521,7 +2521,6 @@ func TestAccContainerCluster_autoprovisioningDefaultsUpgradeSettings(t *testing.
})
}

<% unless version == 'ga' -%>
func TestAccContainerCluster_nodeAutoprovisioningNetworkTags(t *testing.T) {
t.Parallel()

Expand All @@ -2548,7 +2547,6 @@ func TestAccContainerCluster_nodeAutoprovisioningNetworkTags(t *testing.T) {
},
})
}
<% end -%>

func TestAccContainerCluster_withShieldedNodes(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -2660,7 +2658,6 @@ func TestAccContainerCluster_errorAutopilotLocation(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccContainerCluster_withAutopilotNetworkTags(t *testing.T) {
t.Parallel()

Expand All @@ -2685,7 +2682,6 @@ func TestAccContainerCluster_withAutopilotNetworkTags(t *testing.T) {
},
})
}
<% end -%>

func TestAccContainerCluster_withWorkloadIdentityConfig(t *testing.T) {
t.Parallel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ region are guaranteed to support the same version.
to say "these are the _only_ node pools associated with this cluster", use the
[google_container_node_pool](container_node_pool.html) resource instead of this property.

* `node_pool_auto_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Node pool configs that apply to auto-provisioned node pools in
* `node_pool_auto_config` - (Optional) Node pool configs that apply to auto-provisioned node pools in
[autopilot](https://cloud.google.com/kubernetes-engine/docs/concepts/autopilot-overview#comparison) clusters and
[node auto-provisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning)-enabled clusters. Structure is [documented below](#nested_node_pool_auto_config).

Expand Down Expand Up @@ -1019,11 +1019,11 @@ workload_identity_config {

<a name="nested_node_pool_auto_config"></a>The `node_pool_auto_config` block supports:

* `network_tags` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) - The network tag config for the cluster's automatically provisioned node pools.
* `network_tags` (Optional) - The network tag config for the cluster's automatically provisioned node pools.

The `network_tags` block supports:

* `tags` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) - List of network tags applied to auto-provisioned node pools.
* `tags` (Optional) - List of network tags applied to auto-provisioned node pools.

```hcl
node_pool_auto_config {
Expand Down
Loading