Skip to content

Commit

Permalink
add a validation check that source and destination accounts are diffe…
Browse files Browse the repository at this point in the history
…rent
  • Loading branch information
steved committed Oct 4, 2023
1 parent 7f94d5f commit fb9ea82
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 fb9ea82

Please sign in to comment.