Commit 5f4ae710 authored by Daniel Jensen's avatar Daniel Jensen

support final_snapshot_identifier

parent 0e1f9c7a
...@@ -23,39 +23,42 @@ module "db" { ...@@ -23,39 +23,42 @@ module "db" {
source = "terraform-aws-modules/rds/aws" source = "terraform-aws-modules/rds/aws"
identifier = "demodb" identifier = "demodb"
engine = "mysql" engine = "mysql"
engine_version = "5.7.11" engine_version = "5.7.11"
instance_class = "db.t2.large" instance_class = "db.t2.large"
allocated_storage = 5 allocated_storage = 5
name = "demodb" name = "demodb"
username = "user" username = "user"
password = "YourPwdShouldBeLongAndSecure!" password = "YourPwdShouldBeLongAndSecure!"
port = "3306" port = "3306"
vpc_security_group_ids = ["sg-12345678"] vpc_security_group_ids = ["sg-12345678"]
maintenance_window = "Mon:00:00-Mon:03:00" maintenance_window = "Mon:00:00-Mon:03:00"
backup_window = "03:00-06:00" backup_window = "03:00-06:00"
tags = { tags = {
Owner = "user" Owner = "user"
Environment = "dev" Environment = "dev"
} }
# DB subnet group # DB subnet group
subnet_ids = ["subnet-12345678", "subnet-87654321"] subnet_ids = ["subnet-12345678", "subnet-87654321"]
# DB parameter group # DB parameter group
family = "mysql5.7" family = "mysql5.7"
# Snapshot name upon DB deletion
final_snapshot_identifier = "demodb"
parameters = [ parameters = [
{ {
name = "character_set_client" name = "character_set_client"
value = "utf8" value = "utf8"
}, },
{ {
name = "character_set_server" name = "character_set_server"
value = "utf8" value = "utf8"
} }
...@@ -87,4 +90,4 @@ Module managed by [Anton Babenko](https://github.com/antonbabenko). ...@@ -87,4 +90,4 @@ Module managed by [Anton Babenko](https://github.com/antonbabenko).
License License
------- -------
Apache 2 Licensed. See LICENSE for full details. Apache 2 Licensed. See LICENSE for full details.
\ No newline at end of file
...@@ -52,4 +52,7 @@ module "db" { ...@@ -52,4 +52,7 @@ module "db" {
# DB parameter group # DB parameter group
family = "mysql5.7" family = "mysql5.7"
# Snapshot name upon DB deletion
final_snapshot_identifier = "demodb"
} }
...@@ -59,6 +59,7 @@ module "db_instance" { ...@@ -59,6 +59,7 @@ module "db_instance" {
maintenance_window = "${var.maintenance_window}" maintenance_window = "${var.maintenance_window}"
skip_final_snapshot = "${var.skip_final_snapshot}" skip_final_snapshot = "${var.skip_final_snapshot}"
copy_tags_to_snapshot = "${var.copy_tags_to_snapshot}" copy_tags_to_snapshot = "${var.copy_tags_to_snapshot}"
final_snapshot_identifier = "${var.final_snapshot_identifier}"
backup_retention_period = "${var.backup_retention_period}" backup_retention_period = "${var.backup_retention_period}"
backup_window = "${var.backup_window}" backup_window = "${var.backup_window}"
......
...@@ -30,6 +30,7 @@ resource "aws_db_instance" "this" { ...@@ -30,6 +30,7 @@ resource "aws_db_instance" "this" {
maintenance_window = "${var.maintenance_window}" maintenance_window = "${var.maintenance_window}"
skip_final_snapshot = "${var.skip_final_snapshot}" skip_final_snapshot = "${var.skip_final_snapshot}"
copy_tags_to_snapshot = "${var.copy_tags_to_snapshot}" copy_tags_to_snapshot = "${var.copy_tags_to_snapshot}"
final_snapshot_identifier = "${var.final_snapshot_identifier}"
backup_retention_period = "${var.backup_retention_period}" backup_retention_period = "${var.backup_retention_period}"
backup_window = "${var.backup_window}" backup_window = "${var.backup_window}"
......
...@@ -39,6 +39,10 @@ variable "port" { ...@@ -39,6 +39,10 @@ variable "port" {
description = "The port on which the DB accepts connections" description = "The port on which the DB accepts connections"
} }
variable "final_snapshot_identifier" {
description = "The name of your final DB snapshot when this DB instance is deleted."
}
variable "vpc_security_group_ids" { variable "vpc_security_group_ids" {
description = "List of VPC security groups to associate" description = "List of VPC security groups to associate"
default = [] default = []
......
...@@ -19,6 +19,10 @@ variable "engine_version" { ...@@ -19,6 +19,10 @@ variable "engine_version" {
description = "The engine version to use" description = "The engine version to use"
} }
variable "final_snapshot_identifier" {
description = "The name of your final DB snapshot when this DB instance is deleted."
}
variable "instance_class" { variable "instance_class" {
description = "The instance type of the RDS instance" description = "The instance type of the RDS instance"
} }
......
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