Commit a90f423f authored by Bill Wang's avatar Bill Wang Committed by Anton Babenko

Add deletion protection argument (#83)

* Add-deletion_protection-argument

* Add-deletion_protection-argument
parent 4c390c90
...@@ -64,6 +64,9 @@ module "db" { ...@@ -64,6 +64,9 @@ module "db" {
# Snapshot name upon DB deletion # Snapshot name upon DB deletion
final_snapshot_identifier = "demodb" final_snapshot_identifier = "demodb"
# Database Deletion Protection
deletion_protection = true
parameters = [ parameters = [
{ {
name = "character_set_client" name = "character_set_client"
......
...@@ -60,4 +60,7 @@ module "db" { ...@@ -60,4 +60,7 @@ module "db" {
license_model = "license-included" license_model = "license-included"
timezone = "Central Standard Time" timezone = "Central Standard Time"
# Database Deletion Protection
deletion_protection = true
} }
...@@ -68,6 +68,9 @@ module "db" { ...@@ -68,6 +68,9 @@ module "db" {
# Snapshot name upon DB deletion # Snapshot name upon DB deletion
final_snapshot_identifier = "demodb" final_snapshot_identifier = "demodb"
# Database Deletion Protection
deletion_protection = true
options = [ options = [
{ {
option_name = "MARIADB_AUDIT_PLUGIN" option_name = "MARIADB_AUDIT_PLUGIN"
......
...@@ -66,4 +66,7 @@ module "db" { ...@@ -66,4 +66,7 @@ module "db" {
# See here for support character sets https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.OracleCharacterSets.html # See here for support character sets https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.OracleCharacterSets.html
character_set_name = "AL32UTF8" character_set_name = "AL32UTF8"
# Database Deletion Protection
deletion_protection = true
} }
...@@ -67,4 +67,7 @@ module "db" { ...@@ -67,4 +67,7 @@ module "db" {
# Snapshot name upon DB deletion # Snapshot name upon DB deletion
final_snapshot_identifier = "demodb" final_snapshot_identifier = "demodb"
# Database Deletion Protection
deletion_protection = true
} }
...@@ -82,4 +82,6 @@ module "db" { ...@@ -82,4 +82,6 @@ module "db" {
major_engine_version = "5.7" major_engine_version = "5.7"
monitoring_interval = "30" monitoring_interval = "30"
monitoring_role_arn = "${aws_iam_role.rds_enhanced_monitoring.arn}" monitoring_role_arn = "${aws_iam_role.rds_enhanced_monitoring.arn}"
# Database Deletion Protection
deletion_protection = true
} }
...@@ -104,5 +104,7 @@ module "db_instance" { ...@@ -104,5 +104,7 @@ module "db_instance" {
timeouts = "${var.timeouts}" timeouts = "${var.timeouts}"
deletion_protection = "${var.deletion_protection}"
tags = "${var.tags}" tags = "${var.tags}"
} }
...@@ -69,6 +69,8 @@ resource "aws_db_instance" "this" { ...@@ -69,6 +69,8 @@ resource "aws_db_instance" "this" {
timeouts = "${var.timeouts}" timeouts = "${var.timeouts}"
deletion_protection = "${var.deletion_protection}"
tags = "${merge(var.tags, map("Name", format("%s", var.identifier)))}" tags = "${merge(var.tags, map("Name", format("%s", var.identifier)))}"
} }
...@@ -125,5 +127,7 @@ resource "aws_db_instance" "this_mssql" { ...@@ -125,5 +127,7 @@ resource "aws_db_instance" "this_mssql" {
timeouts = "${var.timeouts}" timeouts = "${var.timeouts}"
deletion_protection = "${var.deletion_protection}"
tags = "${merge(var.tags, map("Name", format("%s", var.identifier)))}" tags = "${merge(var.tags, map("Name", format("%s", var.identifier)))}"
} }
...@@ -208,3 +208,8 @@ variable "timeouts" { ...@@ -208,3 +208,8 @@ variable "timeouts" {
delete = "40m" delete = "40m"
} }
} }
variable "deletion_protection" {
description = "The database can't be deleted when this value is set to true."
default = false
}
...@@ -258,3 +258,8 @@ variable "timeouts" { ...@@ -258,3 +258,8 @@ variable "timeouts" {
delete = "40m" delete = "40m"
} }
} }
variable "deletion_protection" {
description = "The database can't be deleted when this value is set to true."
default = false
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment