mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
feat: keep last backup once a managed db is deleted
This commit is contained in:
committed by
Pierre Mavro
parent
33d704ab4b
commit
4d79d21118
@@ -117,5 +117,5 @@ resource "aws_docdb_cluster" "documentdb_cluster" {
|
||||
# Backups
|
||||
backup_retention_period = var.backup_retention_period
|
||||
preferred_backup_window = var.preferred_backup_window
|
||||
skip_final_snapshot = true
|
||||
skip_final_snapshot = var.delete_automated_backups
|
||||
}
|
||||
|
||||
@@ -114,6 +114,12 @@ variable "preferred_backup_window" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "skip_final_snapshot" {
|
||||
description = "Skip final snapshot"
|
||||
default = {{ skip_final_snapshot }}
|
||||
type = bool
|
||||
}
|
||||
|
||||
{%- if snapshot is defined %}
|
||||
# Snapshots
|
||||
variable "snapshot_identifier" {
|
||||
|
||||
@@ -113,7 +113,7 @@ resource "aws_db_instance" "mysql_instance" {
|
||||
# Backups
|
||||
backup_retention_period = var.backup_retention_period
|
||||
backup_window = var.backup_window
|
||||
skip_final_snapshot = true
|
||||
skip_final_snapshot = var.delete_automated_backups
|
||||
delete_automated_backups = var.delete_automated_backups
|
||||
|
||||
}
|
||||
|
||||
@@ -152,6 +152,12 @@ variable "delete_automated_backups" {
|
||||
type = bool
|
||||
}
|
||||
|
||||
variable "skip_final_snapshot" {
|
||||
description = "Skip final snapshot"
|
||||
default = {{ skip_final_snapshot }}
|
||||
type = bool
|
||||
}
|
||||
|
||||
{%- if snapshot is defined %}
|
||||
# Snapshots
|
||||
variable "snapshot_identifier" {
|
||||
|
||||
@@ -115,7 +115,7 @@ resource "aws_db_instance" "postgresql_instance" {
|
||||
# Backups
|
||||
backup_retention_period = var.backup_retention_period
|
||||
backup_window = var.backup_window
|
||||
skip_final_snapshot = true
|
||||
skip_final_snapshot = var.delete_automated_backups
|
||||
delete_automated_backups = var.delete_automated_backups
|
||||
|
||||
}
|
||||
|
||||
@@ -166,6 +166,12 @@ variable "delete_automated_backups" {
|
||||
type = bool
|
||||
}
|
||||
|
||||
variable "skip_final_snapshot" {
|
||||
description = "Skip final snapshot"
|
||||
default = {{ skip_final_snapshot }}
|
||||
type = bool
|
||||
}
|
||||
|
||||
# Snapshots
|
||||
# TODO later
|
||||
#variable "snapshot_identifier" {
|
||||
|
||||
@@ -106,5 +106,8 @@ resource "aws_elasticache_cluster" "elasticache_cluster" {
|
||||
# Backups
|
||||
snapshot_window = var.preferred_backup_window
|
||||
snapshot_retention_limit = var.backup_retention_period
|
||||
{%- if skip_final_snapshot %}
|
||||
final_snapshot_identifier = "${var.elasticache_identifier}-final"
|
||||
{%- endif %}
|
||||
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ impl Service for MongoDB {
|
||||
context.insert("tfstate_suffix_name", &get_tfstate_suffix(self));
|
||||
context.insert("tfstate_name", &get_tfstate_name(self));
|
||||
|
||||
context.insert("skip_final_snapshot", &self.context().is_test_cluster());
|
||||
if self.context.resource_expiration_in_seconds().is_some() {
|
||||
context.insert(
|
||||
"resource_expiration_in_seconds",
|
||||
|
||||
@@ -180,6 +180,7 @@ impl Service for MySQL {
|
||||
context.insert("tfstate_name", &get_tfstate_name(self));
|
||||
|
||||
context.insert("delete_automated_backups", &self.context().is_test_cluster());
|
||||
context.insert("skip_final_snapshot", &self.context().is_test_cluster());
|
||||
if self.context.resource_expiration_in_seconds().is_some() {
|
||||
context.insert(
|
||||
"resource_expiration_in_seconds",
|
||||
|
||||
@@ -180,6 +180,7 @@ impl Service for PostgreSQL {
|
||||
context.insert("tfstate_suffix_name", &get_tfstate_suffix(self));
|
||||
context.insert("tfstate_name", &get_tfstate_name(self));
|
||||
|
||||
context.insert("skip_final_snapshot", &self.context().is_test_cluster());
|
||||
context.insert("delete_automated_backups", &self.context().is_test_cluster());
|
||||
|
||||
if self.context.resource_expiration_in_seconds().is_some() {
|
||||
|
||||
@@ -194,6 +194,7 @@ impl Service for Redis {
|
||||
context.insert("tfstate_suffix_name", &get_tfstate_suffix(self));
|
||||
context.insert("tfstate_name", &get_tfstate_name(self));
|
||||
|
||||
context.insert("skip_final_snapshot", &self.context().is_test_cluster());
|
||||
if self.context.resource_expiration_in_seconds().is_some() {
|
||||
context.insert(
|
||||
"resource_expiration_in_seconds",
|
||||
|
||||
Reference in New Issue
Block a user