Skip to content

Commit

Permalink
Merge pull request #1 from dominodatalab/steved/restrict-accounts
Browse files Browse the repository at this point in the history
add a validation check that source and destination accounts are different
  • Loading branch information
steved authored Oct 5, 2023
2 parents 7f94d5f + fb9ea82 commit e2ba8fb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dst_backup_vault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@ resource "aws_backup_vault" "aws_dst_backup_vault" {
name = "aws_backup_vault"
provider = aws.dst
kms_key_arn = aws_kms_key.aws_dst_backup_kms_key.arn
}

lifecycle {
precondition {
condition = data.aws_caller_identity.current.account_id != data.aws_caller_identity.dst_account.account_id
error_message = "Destination account ID (${data.aws_caller_identity.dst_account.account_id}) must not match source account ID (${data.aws_caller_identity.current.account_id})"
}
}
}

0 comments on commit e2ba8fb

Please sign in to comment.