File tree Expand file tree Collapse file tree 5 files changed +15
-10
lines changed Expand file tree Collapse file tree 5 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -12,5 +12,6 @@ locals {
12
12
13
13
# Helper vars for optional blocks. Will either be an empty set (no) or a
14
14
# single item set (yes)
15
- needs_maintenance_window = var. primary_instance_name == null ? [0 ] : []
15
+ needs_backup_configuration = var. primary_instance_name == null ? [0 ] : []
16
+ needs_maintenance_window = var. primary_instance_name == null ? [0 ] : []
16
17
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -15,15 +15,19 @@ resource "google_sql_database_instance" "instance" {
15
15
tier = local. tier
16
16
user_labels = local. labels
17
17
18
- backup_configuration {
19
- enabled = coalesce (var. backup_config . enabled , var. highly_available )
20
- start_time = var. backup_config . start_time
21
- point_in_time_recovery_enabled = var. backup_config . point_in_time_recovery_enabled
22
- location = coalesce (var. backup_config . enabled , var. highly_available ) ? var. backup_config . location : null
23
- transaction_log_retention_days = var. backup_config . transaction_log_retention_days
24
- backup_retention_settings {
25
- retained_backups = var. backup_config . retained_backups
26
- retention_unit = " COUNT"
18
+ dynamic "backup_configuration" {
19
+ for_each = local. needs_backup_configuration
20
+
21
+ content {
22
+ enabled = coalesce (var. backup_config . enabled , var. highly_available )
23
+ start_time = var. backup_config . start_time
24
+ point_in_time_recovery_enabled = var. backup_config . point_in_time_recovery_enabled
25
+ location = coalesce (var. backup_config . enabled , var. highly_available ) ? var. backup_config . location : null
26
+ transaction_log_retention_days = var. backup_config . transaction_log_retention_days
27
+ backup_retention_settings {
28
+ retained_backups = var. backup_config . retained_backups
29
+ retention_unit = " COUNT"
30
+ }
27
31
}
28
32
}
29
33
You can’t perform that action at this time.
0 commit comments