Skip to content

Commit f389132

Browse files
add gke_backup_agent_config to google_container_cluster (#5940) (#4231)
Signed-off-by: Modular Magician <[email protected]>
1 parent c77fdcf commit f389132

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

.changelog/5940.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
container: added `gke_backup_agent_config` in `addons_config` to `google_container_cluster` (beta)
3+
```

google-beta/resource_container_cluster.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ var (
6565
"addons_config.0.gce_persistent_disk_csi_driver_config",
6666
"addons_config.0.kalm_config",
6767
"addons_config.0.config_connector_config",
68+
"addons_config.0.gke_backup_agent_config",
6869
}
6970

7071
forceNewClusterNodeConfigFields = []string{
@@ -377,6 +378,22 @@ func resourceContainerCluster() *schema.Resource {
377378
},
378379
},
379380
},
381+
"gke_backup_agent_config": {
382+
Type: schema.TypeList,
383+
Optional: true,
384+
Computed: true,
385+
AtLeastOneOf: addonsConfigKeys,
386+
MaxItems: 1,
387+
Description: `The status of the Backup for GKE Agent addon. It is disabled by default. Set enabled = true to enable.`,
388+
Elem: &schema.Resource{
389+
Schema: map[string]*schema.Schema{
390+
"enabled": {
391+
Type: schema.TypeBool,
392+
Required: true,
393+
},
394+
},
395+
},
396+
},
380397
},
381398
},
382399
},
@@ -3040,6 +3057,13 @@ func expandClusterAddonsConfig(configured interface{}) *container.AddonsConfig {
30403057
ForceSendFields: []string{"Enabled"},
30413058
}
30423059
}
3060+
if v, ok := config["gke_backup_agent_config"]; ok && len(v.([]interface{})) > 0 {
3061+
addon := v.([]interface{})[0].(map[string]interface{})
3062+
ac.GkeBackupAgentConfig = &container.GkeBackupAgentConfig{
3063+
Enabled: addon["enabled"].(bool),
3064+
ForceSendFields: []string{"Enabled"},
3065+
}
3066+
}
30433067

30443068
return ac
30453069
}
@@ -3682,6 +3706,13 @@ func flattenClusterAddonsConfig(c *container.AddonsConfig) []map[string]interfac
36823706
},
36833707
}
36843708
}
3709+
if c.GkeBackupAgentConfig != nil {
3710+
result["gke_backup_agent_config"] = []map[string]interface{}{
3711+
{
3712+
"enabled": c.GkeBackupAgentConfig.Enabled,
3713+
},
3714+
}
3715+
}
36853716
return []map[string]interface{}{result}
36863717
}
36873718

google-beta/resource_container_cluster_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,6 +2574,9 @@ resource "google_container_cluster" "primary" {
25742574
config_connector_config {
25752575
enabled = false
25762576
}
2577+
gke_backup_agent_config {
2578+
enabled = false
2579+
}
25772580
}
25782581
}
25792582
`, projectID, clusterName)
@@ -2628,6 +2631,9 @@ resource "google_container_cluster" "primary" {
26282631
config_connector_config {
26292632
enabled = true
26302633
}
2634+
gke_backup_agent_config {
2635+
enabled = true
2636+
}
26312637
}
26322638
}
26332639
`, projectID, clusterName)

website/docs/r/container_cluster.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ subnetwork in which the cluster's instances are launched.
394394
* `config_connector_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
395395
The status of the ConfigConnector addon. It is disabled by default; Set `enabled = true` to enable.
396396

397+
* `gke_backup_agent_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
398+
The status of the Backup for GKE agent addon. It is disabled by default; Set `enabled = true` to enable.
399+
397400
This example `addons_config` disables two addons:
398401

399402
```hcl

0 commit comments

Comments
 (0)