Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support final_snapshot_identifier #3

Merged
Merged
Show file tree
Hide file tree
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
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ module "db" {
source = "terraform-aws-modules/rds/aws"

identifier = "demodb"

Copy link
Member

Choose a reason for hiding this comment

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

Good catch with all these spaces.

engine = "mysql"
engine_version = "5.7.11"
instance_class = "db.t2.large"
allocated_storage = 5

name = "demodb"
username = "user"
password = "YourPwdShouldBeLongAndSecure!"
port = "3306"

vpc_security_group_ids = ["sg-12345678"]

maintenance_window = "Mon:00:00-Mon:03:00"
backup_window = "03:00-06:00"

Expand All @@ -47,19 +47,22 @@ module "db" {
Owner = "user"
Environment = "dev"
}

# DB subnet group
subnet_ids = ["subnet-12345678", "subnet-87654321"]

# DB parameter group
family = "mysql5.7"

# Snapshot name upon DB deletion
final_snapshot_identifier = "demodb"

parameters = [
{
{
name = "character_set_client"
value = "utf8"
},
{
{
name = "character_set_server"
value = "utf8"
}
Expand Down Expand Up @@ -91,4 +94,4 @@ Module managed by [Anton Babenko](https://github.com/antonbabenko).
License
-------

Apache 2 Licensed. See LICENSE for full details.
Apache 2 Licensed. See LICENSE for full details.
3 changes: 3 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ module "db" {
subnet_ids = ["${data.aws_subnet_ids.all.ids}"]
# DB parameter group
family = "mysql5.7"

# Snapshot name upon DB deletion
final_snapshot_identifier = "demodb"
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module "db_instance" {
maintenance_window = "${var.maintenance_window}"
skip_final_snapshot = "${var.skip_final_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_window = "${var.backup_window}"
Expand Down
1 change: 1 addition & 0 deletions modules/db_instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ resource "aws_db_instance" "this" {
maintenance_window = "${var.maintenance_window}"
skip_final_snapshot = "${var.skip_final_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_window = "${var.backup_window}"
Expand Down
5 changes: 5 additions & 0 deletions modules/db_instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ variable "port" {
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."
default = ""
}

variable "vpc_security_group_ids" {
description = "List of VPC security groups to associate"
default = []
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ variable "engine_version" {
description = "The engine version to use"
}

variable "final_snapshot_identifier" {
description = "The name of your final DB snapshot when this DB instance is deleted."
default = ""
}

variable "instance_class" {
description = "The instance type of the RDS instance"
}
Expand Down