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

gke_backup_agent_config: support from beta to ga #13223

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6898.txt
@@ -0,0 +1,3 @@
```release-note:enhancement
container: promoted `gke_backup_agent_config` in `google_container_cluster` to GA
```
31 changes: 31 additions & 0 deletions google/resource_container_cluster.go
Expand Up @@ -68,6 +68,7 @@ var (
"addons_config.0.gcp_filestore_csi_driver_config",
"addons_config.0.dns_cache_config",
"addons_config.0.gce_persistent_disk_csi_driver_config",
"addons_config.0.gke_backup_agent_config",
}

privateClusterConfigKeys = []string{
Expand Down Expand Up @@ -366,6 +367,22 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
"gke_backup_agent_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
AtLeastOneOf: addonsConfigKeys,
MaxItems: 1,
Description: `The status of the Backup for GKE Agent addon. It is disabled by default. Set enabled = true to enable.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
},
},
},
},
},
},
},
Expand Down Expand Up @@ -3357,6 +3374,13 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
ForceSendFields: []string{"Enabled"},
}
}
if v, ok := config["gke_backup_agent_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.GkeBackupAgentConfig = &container.GkeBackupAgentConfig{
Enabled: addon["enabled"].(bool),
ForceSendFields: []string{"Enabled"},
}
}

return ac
}
Expand Down Expand Up @@ -4205,6 +4229,13 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
},
}
}
if c.GkeBackupAgentConfig != nil {
result["gke_backup_agent_config"] = []map[string]interface{}{
{
"enabled": c.GkeBackupAgentConfig.Enabled,
},
}
}

return []map[string]interface{}{result}
}
Expand Down
6 changes: 6 additions & 0 deletions google/resource_container_cluster_test.go
Expand Up @@ -3166,6 +3166,9 @@ resource "google_container_cluster" "primary" {
gce_persistent_disk_csi_driver_config {
enabled = false
}
gke_backup_agent_config {
enabled = false
}
}
}
`, projectID, clusterName)
Expand Down Expand Up @@ -3212,6 +3215,9 @@ resource "google_container_cluster" "primary" {
gce_persistent_disk_csi_driver_config {
enabled = true
}
gke_backup_agent_config {
enabled = true
}
}
}
`, projectID, clusterName)
Expand Down
2 changes: 1 addition & 1 deletion google/validation_test.go
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)

func TestvalidateGCEName(t *testing.T) {
func TestValidateGCEName(t *testing.T) {
x := []StringValidationTestCase{
// No errors
{TestName: "basic", Value: "foobar"},
Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/container_cluster.html.markdown
Expand Up @@ -403,14 +403,15 @@ subnetwork in which the cluster's instances are launched.
* `gce_persistent_disk_csi_driver_config` - (Optional).
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. Defaults to disabled; set `enabled = true` to enabled.

* `gke_backup_agent_config` - (Optional).
The status of the Backup for GKE agent addon. It is disabled by default; Set `enabled = true` to enable.

* `kalm_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Configuration for the KALM addon, which manages the lifecycle of k8s. It is disabled by default; Set `enabled = true` to enable.

* `config_connector_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
The status of the ConfigConnector addon. It is disabled by default; Set `enabled = true` to enable.

* `gke_backup_agent_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
The status of the Backup for GKE agent addon. It is disabled by default; Set `enabled = true` to enable.

This example `addons_config` disables two addons:

Expand Down