Skip to content

Commit 3f671bb

Browse files
committed
add option to override the S3 backup bucket name
1 parent 0bdf1e4 commit 3f671bb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

modules/032-db-backup/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ locals {
77
"arn:aws:rds:${local.aws_region}:${local.aws_account}:db:idp-${var.idp_name}-${var.app_env}"
88
)
99
)
10+
s3_backup_bucket = coalesce(var.s3_backup_bucket, "${var.idp_name}-${var.app_name}-${var.app_env}")
1011
}
1112

1213

@@ -22,7 +23,7 @@ data "aws_region" "current" {}
2223
* Create S3 bucket for storing backups
2324
*/
2425
resource "aws_s3_bucket" "backup" {
25-
bucket = "${var.idp_name}-${var.app_name}-${var.app_env}"
26+
bucket = local.s3_backup_bucket
2627
force_destroy = true
2728

2829
tags = {

modules/032-db-backup/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ variable "rds_arn" {
9292
default = ""
9393
}
9494

95+
variable "s3_backup_bucket" {
96+
description = <<-EOT
97+
The name of the S3 bucket to use for backup storage. If not specified, a bucket will be created with the name
98+
{var.idp_name}-{var.app_name}-{var.app_env}.
99+
EOT
100+
type = string
101+
default = ""
102+
}
103+
95104
variable "service_mode" {
96105
description = "Service mode, either `backup` or `restore`"
97106
type = string

0 commit comments

Comments
 (0)