File tree Expand file tree Collapse file tree 3 files changed +71
-3
lines changed
modules/beta-private-cluster-update-variant Expand file tree Collapse file tree 3 files changed +71
-3
lines changed Original file line number Diff line number Diff line change 1+ # Add backup plan resources outside the cluster resource
2+ resource "google_gke_backup_backup_plan" "this" {
3+ for_each = {
4+ for plan in try (var. gke_backup_agent_config . backup_plans , []) :
5+ plan.name = > plan
6+ if try (var. gke_backup_agent_config . enabled , false )
7+ }
8+
9+ name = each. value . name
10+ location = each. value . location
11+ cluster = each. value . cluster
12+
13+ description = try (each. value . description , null )
14+ labels = try (each. value . labels , null )
15+
16+ dynamic "retention_policy" {
17+ for_each = each. value . retention_policy != null ? [each . value . retention_policy ] : []
18+ content {
19+ backup_delete_lock_days = try (retention_policy. value . backup_delete_lock_days , null )
20+ backup_retain_days = try (retention_policy. value . backup_retain_days , null )
21+ locked = try (retention_policy. value . locked , null )
22+ }
23+ }
24+
25+ dynamic "schedule" {
26+ for_each = each. value . schedule != null ? [each . value . schedule ] : []
27+ content {
28+ cron_schedule = schedule. value . cron_schedule
29+ paused = try (schedule. value . paused , null )
30+ }
31+ }
32+ }
Original file line number Diff line number Diff line change @@ -205,3 +205,18 @@ output "tpu_ipv4_cidr_block" {
205205 description = " The IP range in CIDR notation used for the TPUs"
206206 value = var. enable_tpu ? google_container_cluster. primary . tpu_ipv4_cidr_block : null
207207}
208+
209+ output "gke_backup_agent_config_enabled" {
210+ value = var. gke_backup_agent_config . enabled
211+ description = " Whether the Backup for GKE agent is enabled."
212+ }
213+
214+ output "gke_backup_backup_plan_ids" {
215+ value = { for k , v in google_gke_backup_backup_plan . this : k => v . id }
216+ description = " IDs of created Backup for GKE backup plans."
217+ }
218+
219+ output "gke_backup_backup_plan_names" {
220+ value = { for k , v in google_gke_backup_backup_plan . this : k => v . name }
221+ description = " Names of created Backup for GKE backup plans."
222+ }
Original file line number Diff line number Diff line change @@ -631,9 +631,30 @@ variable "gce_pd_csi_driver" {
631631}
632632
633633variable "gke_backup_agent_config" {
634- type = bool
635- description = " Whether Backup for GKE agent is enabled for this cluster."
636- default = false
634+ description = " Config for Backup for GKE add-on and backup plans"
635+ type = object ({
636+ enabled = bool
637+ backup_plans = optional (list (object ({
638+ name = string
639+ location = string
640+ cluster = string
641+ description = optional (string )
642+ labels = optional (map (string ))
643+ retention_policy = optional (object ({
644+ backup_delete_lock_days = optional (number )
645+ backup_retain_days = optional (number )
646+ locked = optional (bool )
647+ }))
648+ schedule = optional (object ({
649+ cron_schedule = string
650+ paused = optional (bool )
651+ }))
652+ })), [])
653+ })
654+ default = {
655+ enabled = false
656+ backup_plans = []
657+ }
637658}
638659
639660variable "timeouts" {
You can’t perform that action at this time.
0 commit comments