fix: aws managed services couldn't be deleted

Note: this makes tests way longer, but this is the only way to test it
properly. If it was the case before, this bug would never happen
This commit is contained in:
Pierre Mavro
2021-11-03 17:27:12 +01:00
committed by Pierre Mavro
parent 6441e7633a
commit 8c0b769531
13 changed files with 54 additions and 7 deletions

View File

@@ -118,4 +118,7 @@ resource "aws_docdb_cluster" "documentdb_cluster" {
backup_retention_period = var.backup_retention_period
preferred_backup_window = var.preferred_backup_window
skip_final_snapshot = var.skip_final_snapshot
{%- if not skip_final_snapshot %}
final_snapshot_identifier = var.final_snapshot_name
{%- endif %}
}

View File

@@ -120,6 +120,12 @@ variable "skip_final_snapshot" {
type = bool
}
variable "final_snapshot_name" {
description = "Name of the final snapshot before the database goes deleted"
default = "{{ final_snapshot_name }}"
type = string
}
{%- if snapshot is defined %}
# Snapshots
variable "snapshot_identifier" {

View File

@@ -132,6 +132,10 @@ resource "aws_db_instance" "mysql_instance" {
backup_retention_period = var.backup_retention_period
backup_window = var.backup_window
skip_final_snapshot = var.skip_final_snapshot
{%- if not skip_final_snapshot %}
final_snapshot_identifier = var.final_snapshot_name
{%- endif %}
copy_tags_to_snapshot = true
delete_automated_backups = var.delete_automated_backups
}

View File

@@ -164,6 +164,12 @@ variable "skip_final_snapshot" {
type = bool
}
variable "final_snapshot_name" {
description = "Name of the final snapshot before the database goes deleted"
default = "{{ final_snapshot_name }}"
type = string
}
{%- if snapshot is defined %}
# Snapshots
variable "snapshot_identifier" {

View File

@@ -116,6 +116,10 @@ resource "aws_db_instance" "postgresql_instance" {
backup_retention_period = var.backup_retention_period
backup_window = var.backup_window
skip_final_snapshot = var.skip_final_snapshot
{%- if not skip_final_snapshot %}
final_snapshot_identifier = var.final_snapshot_name
{%- endif %}
copy_tags_to_snapshot = true
delete_automated_backups = var.delete_automated_backups
}

View File

@@ -172,6 +172,12 @@ variable "skip_final_snapshot" {
type = bool
}
variable "final_snapshot_name" {
description = "Name of the final snapshot before the database goes deleted"
default = "{{ final_snapshot_name }}"
type = string
}
# Snapshots
#variable "snapshot_identifier" {
# description = "Snapshot ID to restore"

View File

@@ -106,8 +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"
{%- if not skip_final_snapshot %}
final_snapshot_identifier = var.final_snapshot_name
{%- endif %}
}

View File

@@ -114,6 +114,12 @@ variable "preferred_backup_window" {
type = string
}
variable "final_snapshot_name" {
description = "Name of the final snapshot before the database goes deleted"
default = "{{ final_snapshot_name }}"
type = string
}
{%- if snapshot is defined %}
# Snapshots
variable "snapshot_identifier" {