Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/mysql/read_replica.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ resource "google_sql_database_instance" "replicas" {
content {
binary_log_enabled = lookup(backup_configuration.value, "binary_log_enabled", null)
transaction_log_retention_days = lookup(backup_configuration.value, "transaction_log_retention_days", null)
backup_retention_settings {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diablo02000 can we use TF validation for variable to make sure it is correct value? Changing values in code is not a good experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback @imrannayer. What do you have in mind ? Allow only value greater that 7 for transaction_log_retention_days ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes validate in variable.

retained_backups = lookup(backup_configuration.value, "transaction_log_retention_days", 0) > 7 ? lookup(backup_configuration.value, "transaction_log_retention_days") + 1 : null
retention_unit = "COUNT"
}
}
}

Expand Down