Skip to content

Commit 9991541

Browse files
[feature] Add 'snapshot_identifier' to all aws-aurora modules (#323)
* 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]>
1 parent dd16384 commit 9991541

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

aws-aurora-mysql/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module "aurora" {
3232
instance_count = var.instance_count
3333

3434
backtrack_window = var.backtrack_window
35+
snapshot_identifier = var.snapshot_identifier
3536
skip_final_snapshot = var.skip_final_snapshot
3637

3738
kms_key_id = var.kms_key_id

aws-aurora-mysql/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ variable "project" {
5757
description = "Project for tagging and naming. See [doc](../README.md#consistent-tagging)"
5858
}
5959

60+
variable "snapshot_identifier" {
61+
type = string
62+
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."
63+
default = null
64+
}
65+
6066
variable "skip_final_snapshot" {
6167
type = string
6268
description = "When you destroy a database RDS will, by default, take snapshot. Set this to skip that step."

aws-aurora-postgres/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module "aurora" {
4040

4141
# backtrack_window not supported yet
4242
backtrack_window = 0
43+
snapshot_identifier = var.snapshot_identifier
4344
skip_final_snapshot = var.skip_final_snapshot
4445
kms_key_id = var.kms_key_id
4546
apply_immediately = var.apply_immediately

aws-aurora-postgres/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ variable "publicly_accessible" {
7373
default = false
7474
}
7575

76+
variable "snapshot_identifier" {
77+
type = string
78+
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."
79+
default = null
80+
}
81+
7682
variable "skip_final_snapshot" {
7783
type = string
7884
description = "When you destroy a database RDS will, by default, take snapshot. Set this to skip that step."

aws-aurora/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ resource "aws_rds_cluster" "db" {
5959
storage_encrypted = true
6060
iam_database_authentication_enabled = var.iam_database_authentication_enabled
6161
backup_retention_period = 28
62+
snapshot_identifier = var.snapshot_identifier
6263
final_snapshot_identifier = "${local.name}-snapshot"
6364
skip_final_snapshot = var.skip_final_snapshot
6465
backtrack_window = var.backtrack_window

aws-aurora/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ variable "project" {
5151
description = "Project for tagging and naming. See [doc](../README.md#consistent-tagging)"
5252
}
5353

54+
variable "snapshot_identifier" {
55+
type = string
56+
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."
57+
default = null
58+
}
59+
5460
variable "skip_final_snapshot" {
5561
default = false
5662
}

0 commit comments

Comments
 (0)