1- data "aws_secretsmanager_secret" "source_account_id " {
2- name = " backups-source-account-id"
1+ data "aws_secretsmanager_secret" "source_account_id_prod " {
2+ name = " backups-source-account-id-prod "
33}
44
5- data "aws_secretsmanager_secret_version" "source_account_id" {
6- secret_id = data. aws_secretsmanager_secret . source_account_id . id
5+ data "aws_secretsmanager_secret_version" "source_account_id_prod" {
6+ secret_id = data. aws_secretsmanager_secret . source_account_id_prod . id
7+ }
8+
9+ data "aws_secretsmanager_secret" "source_account_id_dev" {
10+ name = " backups-source-account-id-dev"
11+ }
12+
13+ data "aws_secretsmanager_secret_version" "source_account_id_dev" {
14+ secret_id = data. aws_secretsmanager_secret . source_account_id_dev . id
715}
816
917
@@ -15,12 +23,33 @@ resource "aws_kms_key" "destination_backup_key" {
1523 enable_key_rotation = true
1624}
1725
18- module "destination" {
26+ module "destination_prod" {
27+ source = " ../modules/aws-backup-destination"
28+
29+ source_account_name = " prod" # please note that the assigned value would be the prefix in aws_backup_vault.vault.name - change to dev/prod
30+ account_id = var. assume_account
31+ source_account_id = data. aws_secretsmanager_secret_version . source_account_id_prod . secret_string
32+ kms_key = aws_kms_key. destination_backup_key . arn
33+ enable_vault_protection = false
34+ }
35+
36+ # ##
37+ # Destination vault ARN output
38+ # ##
39+
40+ output "destination_vault_arn_prod" {
41+ # The ARN of the backup vault in the destination account is needed by
42+ # the source account to copy backups into it.
43+ value = module. destination_prod . vault_arn
44+ }
45+
46+
47+ module "destination_dev" {
1948 source = " ../modules/aws-backup-destination"
2049
21- source_account_name = " dev" # please note that the assigned value would be the prefix in aws_backup_vault.vault.name - change to dev/prod BACKUPS_LOGIC
50+ source_account_name = " dev" # please note that the assigned value would be the prefix in aws_backup_vault.vault.name - change to dev/prod
2251 account_id = var. assume_account
23- source_account_id = data. aws_secretsmanager_secret_version . source_account_id . secret_string
52+ source_account_id = data. aws_secretsmanager_secret_version . source_account_id_dev . secret_string
2453 kms_key = aws_kms_key. destination_backup_key . arn
2554 enable_vault_protection = false
2655}
@@ -29,8 +58,8 @@ module "destination" {
2958# Destination vault ARN output
3059# ##
3160
32- output "destination_vault_arn " {
61+ output "destination_vault_arn_dev " {
3362 # The ARN of the backup vault in the destination account is needed by
3463 # the source account to copy backups into it.
35- value = module. destination . vault_arn
64+ value = module. destination_dev . vault_arn
3665}
0 commit comments