Skip to content

Commit

Permalink
[feature] Add 'snapshot_identifier' to all aws-aurora modules (#323)
Browse files Browse the repository at this point in the history
* Add 'snapshot_identifier' to all aws-aurora modules

This will support creating a new RDS cluster from an existing snapshot, e.g. for
data mirroring to a different env.

* Set empty default for aurora inital snapshot variable

* Make default snapshot identifier null

Co-authored-by: Andrew Tolopko <[email protected]>
  • Loading branch information
mbarrien and atolopko-czi authored Jul 8, 2021
1 parent dd16384 commit 9991541
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions aws-aurora-mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module "aurora" {
instance_count = var.instance_count

backtrack_window = var.backtrack_window
snapshot_identifier = var.snapshot_identifier
skip_final_snapshot = var.skip_final_snapshot

kms_key_id = var.kms_key_id
Expand Down
6 changes: 6 additions & 0 deletions aws-aurora-mysql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ variable "project" {
description = "Project for tagging and naming. See [doc](../README.md#consistent-tagging)"
}

variable "snapshot_identifier" {
type = string
description = "Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot."
default = null
}

variable "skip_final_snapshot" {
type = string
description = "When you destroy a database RDS will, by default, take snapshot. Set this to skip that step."
Expand Down
1 change: 1 addition & 0 deletions aws-aurora-postgres/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module "aurora" {

# backtrack_window not supported yet
backtrack_window = 0
snapshot_identifier = var.snapshot_identifier
skip_final_snapshot = var.skip_final_snapshot
kms_key_id = var.kms_key_id
apply_immediately = var.apply_immediately
Expand Down
6 changes: 6 additions & 0 deletions aws-aurora-postgres/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ variable "publicly_accessible" {
default = false
}

variable "snapshot_identifier" {
type = string
description = "Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot."
default = null
}

variable "skip_final_snapshot" {
type = string
description = "When you destroy a database RDS will, by default, take snapshot. Set this to skip that step."
Expand Down
1 change: 1 addition & 0 deletions aws-aurora/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ resource "aws_rds_cluster" "db" {
storage_encrypted = true
iam_database_authentication_enabled = var.iam_database_authentication_enabled
backup_retention_period = 28
snapshot_identifier = var.snapshot_identifier
final_snapshot_identifier = "${local.name}-snapshot"
skip_final_snapshot = var.skip_final_snapshot
backtrack_window = var.backtrack_window
Expand Down
6 changes: 6 additions & 0 deletions aws-aurora/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ variable "project" {
description = "Project for tagging and naming. See [doc](../README.md#consistent-tagging)"
}

variable "snapshot_identifier" {
type = string
description = "Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot."
default = null
}

variable "skip_final_snapshot" {
default = false
}
Expand Down

0 comments on commit 9991541

Please sign in to comment.