Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Enable usage of gcp filestore csi driver #494

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
3 changes: 3 additions & 0 deletions converters/google/provider/.changelog/5648.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
container: added support for GCPFilestoreCSIDriver addon to `google_container_cluster` resource.
```
34 changes: 34 additions & 0 deletions converters/google/provider/google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
"addons_config.0.horizontal_pod_autoscaling",
"addons_config.0.network_policy_config",
"addons_config.0.cloudrun_config",
"addons_config.0.gcp_filestore_csi_driver_config",
}

forceNewClusterNodeConfigFields = []string{
Expand Down Expand Up @@ -228,6 +229,23 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
"gcp_filestore_csi_driver_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: addonsConfigKeys,
MaxItems: 1,
Description: `The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes. Defaults to disabled; set enabled = true to enable.`,
ConflictsWith: []string{"enable_autopilot"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
},
},
},
},
"cloudrun_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -2564,6 +2582,14 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
}
}

if v, ok := config["gcp_filestore_csi_driver_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.GcpFilestoreCsiDriverConfig = &container.GcpFilestoreCsiDriverConfig{
Enabled: addon["enabled"].(bool),
ForceSendFields: []string{"Enabled"},
}
}

if v, ok := config["cloudrun_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.CloudRunConfig = &container.CloudRunConfig{
Expand Down Expand Up @@ -3068,6 +3094,14 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
}
}

if c.GcpFilestoreCsiDriverConfig != nil {
result["gcp_filestore_csi_driver_config"] = []map[string]interface{}{
{
"enabled": c.GcpFilestoreCsiDriverConfig.Enabled,
},
}
}

if c.CloudRunConfig != nil {
cloudRunConfig := map[string]interface{}{
"disabled": c.CloudRunConfig.Disabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,9 @@ resource "google_container_cluster" "primary" {
network_policy_config {
disabled = true
}
gcp_filestore_csi_driver_config {
enabled = false
}
cloudrun_config {
disabled = true
}
Expand Down Expand Up @@ -2130,6 +2133,9 @@ resource "google_container_cluster" "primary" {
network_policy_config {
disabled = false
}
gcp_filestore_csi_driver_config {
enabled = true
}
cloudrun_config {
disabled = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ subnetwork in which the cluster's instances are launched.
It can only be disabled if the nodes already do not have network policies enabled.
Defaults to disabled; set `disabled = false` to enable.

* `gcp_filestore_csi_driver_config` - (Optional) The status of the Filestore CSI driver addon,
which allows the usage of filestore instance as volumes.
It is disbaled by default; set `enabled = true` to enable.

* `cloudrun_config` - (Optional). Structure is [documented below](#nested_cloudrun_config).

* `istio_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Expand Down