Skip to content

Commit

Permalink
Add another backup vault (#1179)
Browse files Browse the repository at this point in the history
* Add another backup vault
  • Loading branch information
aleksandra-fromm authored Oct 24, 2023
1 parent c6e54dc commit dce05c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion _sub/security/aws-backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ resource "aws_backup_vault" "this" {
tags = var.tags
}

resource "aws_backup_vault" "vault" {
name = var.new_vault_name
tags = var.tags
}

resource "aws_kms_key" "this" {
count = var.deploy_kms_key ? 1 : 0
description = "KMS key for backup encryption"
Expand Down Expand Up @@ -84,7 +89,7 @@ resource "aws_backup_plan" "this" {

content {
rule_name = rule.value.name
target_vault_name = aws_backup_vault.this.name
target_vault_name = aws_backup_vault.vault.name
schedule = lookup(rule.value, "schedule", null)
enable_continuous_backup = lookup(rule.value, "enable_continuous_backup", false)
start_window = lookup(rule.value, "start_window", null)
Expand Down
9 changes: 8 additions & 1 deletion _sub/security/aws-backup/vars.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# TODO: This variable needs to be renamed to `vault_name` after we remove the vault we created initially.
variable "new_vault_name" {
type = string
description = "The name of the vault."
default = null
}

variable "vault_name" {
type = string
description = "The name of the Vault."
description = "The name of the vault we created initially. This vault will eventually be removed."
default = null
}

Expand Down
2 changes: 2 additions & 0 deletions security/org-account-context/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ module "backup_eu_central_1" {
resource_type_management_preference = var.aws_backup_resource_type_management_preference

vault_name = var.aws_backup_vault_name
new_vault_name = var.aws_backup_vault_name_new
deploy_kms_key = local.deploy_kms_key
kms_key_admins = local.kms_key_admins
backup_plans = var.aws_backup_plans
Expand All @@ -337,6 +338,7 @@ module "backup_eu_west_1" {
resource_type_management_preference = var.aws_backup_resource_type_management_preference

vault_name = var.aws_backup_vault_name
new_vault_name = var.aws_backup_vault_name_new
deploy_kms_key = local.deploy_kms_key
kms_key_admins = local.kms_key_admins
backup_plans = var.aws_backup_plans
Expand Down
7 changes: 7 additions & 0 deletions security/org-account-context/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,18 @@ variable "aws_backup_resource_type_management_preference" {
}

variable "aws_backup_vault_name" {
type = string
description = "Name of the AWS Backup vault. This is the name of the vault we created initially and will be removed eventually."
default = null
}

variable "aws_backup_vault_name_new" {
type = string
description = "Name of the AWS Backup vault"
default = null
}


variable "aws_backup_plans" {
type = list(object({
plan_name = string
Expand Down

0 comments on commit dce05c3

Please sign in to comment.