Skip to content

Commit d3e9199

Browse files
gke_backup_agent_config: support from beta to ga (#6898) (#13223)
* promote backup to ga * gke_backup_agent_config: doc update * fix typo in a test func name * retrigger checks * update test for gke backup config in ga Co-authored-by: Shubham Singh <[email protected]> Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Shubham Singh <[email protected]>
1 parent ad1522e commit d3e9199

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

.changelog/6898.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
container: promoted `gke_backup_agent_config` in `google_container_cluster` to GA
3+
```

google/resource_container_cluster.go

+31
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ var (
6868
"addons_config.0.gcp_filestore_csi_driver_config",
6969
"addons_config.0.dns_cache_config",
7070
"addons_config.0.gce_persistent_disk_csi_driver_config",
71+
"addons_config.0.gke_backup_agent_config",
7172
}
7273

7374
privateClusterConfigKeys = []string{
@@ -366,6 +367,22 @@ func resourceContainerCluster() *schema.Resource {
366367
},
367368
},
368369
},
370+
"gke_backup_agent_config": {
371+
Type: schema.TypeList,
372+
Optional: true,
373+
Computed: true,
374+
AtLeastOneOf: addonsConfigKeys,
375+
MaxItems: 1,
376+
Description: `The status of the Backup for GKE Agent addon. It is disabled by default. Set enabled = true to enable.`,
377+
Elem: &schema.Resource{
378+
Schema: map[string]*schema.Schema{
379+
"enabled": {
380+
Type: schema.TypeBool,
381+
Required: true,
382+
},
383+
},
384+
},
385+
},
369386
},
370387
},
371388
},
@@ -3357,6 +3374,13 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
33573374
ForceSendFields: []string{"Enabled"},
33583375
}
33593376
}
3377+
if v, ok := config["gke_backup_agent_config"]; ok && len(v.([]interface{})) > 0 {
3378+
addon := v.([]interface{})[0].(map[string]interface{})
3379+
ac.GkeBackupAgentConfig = &container.GkeBackupAgentConfig{
3380+
Enabled: addon["enabled"].(bool),
3381+
ForceSendFields: []string{"Enabled"},
3382+
}
3383+
}
33603384

33613385
return ac
33623386
}
@@ -4205,6 +4229,13 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
42054229
},
42064230
}
42074231
}
4232+
if c.GkeBackupAgentConfig != nil {
4233+
result["gke_backup_agent_config"] = []map[string]interface{}{
4234+
{
4235+
"enabled": c.GkeBackupAgentConfig.Enabled,
4236+
},
4237+
}
4238+
}
42084239

42094240
return []map[string]interface{}{result}
42104241
}

google/resource_container_cluster_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -3166,6 +3166,9 @@ resource "google_container_cluster" "primary" {
31663166
gce_persistent_disk_csi_driver_config {
31673167
enabled = false
31683168
}
3169+
gke_backup_agent_config {
3170+
enabled = false
3171+
}
31693172
}
31703173
}
31713174
`, projectID, clusterName)
@@ -3212,6 +3215,9 @@ resource "google_container_cluster" "primary" {
32123215
gce_persistent_disk_csi_driver_config {
32133216
enabled = true
32143217
}
3218+
gke_backup_agent_config {
3219+
enabled = true
3220+
}
32153221
}
32163222
}
32173223
`, projectID, clusterName)

google/validation_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1111
)
1212

13-
func TestvalidateGCEName(t *testing.T) {
13+
func TestValidateGCEName(t *testing.T) {
1414
x := []StringValidationTestCase{
1515
// No errors
1616
{TestName: "basic", Value: "foobar"},

website/docs/r/container_cluster.html.markdown

+3-2
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,15 @@ subnetwork in which the cluster's instances are launched.
403403
* `gce_persistent_disk_csi_driver_config` - (Optional).
404404
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. Defaults to disabled; set `enabled = true` to enabled.
405405

406+
* `gke_backup_agent_config` - (Optional).
407+
The status of the Backup for GKE agent addon. It is disabled by default; Set `enabled = true` to enable.
408+
406409
* `kalm_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
407410
Configuration for the KALM addon, which manages the lifecycle of k8s. It is disabled by default; Set `enabled = true` to enable.
408411

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

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

415416
This example `addons_config` disables two addons:
416417

0 commit comments

Comments
 (0)