@@ -70,12 +70,13 @@ Parameters:
7070 AllowedPattern : ' arn:(aws|aws-us-gov):s3:::.*'
7171 KMSKeyARN :
7272 Type : String
73- Description : The ARN of the KMS key used to encrypt the S3 bucket.
73+ Description : (Optional) The ARN of the KMS key used to encrypt the S3 bucket.
7474 Default : " "
7575 KMSAccountId :
7676 Type : String
77- Description : The AWS Account ID that owns the KMS key.
78- AllowedPattern : ' ^[0-9]{12}$'
77+ Description : (Optional) The AWS Account ID that owns the KMS key.
78+ AllowedPattern : ' (^$|^[0-9]{12}$)'
79+ Default : " "
7980 BucketAccountId :
8081 Type : String
8182 Description : The AWS Account ID that owns the S3 bucket, if different from the current account.
@@ -108,6 +109,14 @@ Parameters:
108109Conditions :
109110 CreateSNSTopic : !Equals [ !Ref CreateTopic, "true" ]
110111 HasKMSKey : !Not [ !Equals [ !Ref KMSKeyARN, "" ] ]
112+ HasKMSAccountId : !Not [ !Equals [ !Ref KMSAccountId, "" ] ]
113+
114+ NeedKMSPolicy : !And [
115+ !Condition HasKMSKey,
116+ !Condition HasKMSAccountId,
117+ !Not [ !Equals [ !Ref KMSAccountId, !Ref BucketAccountId ] ]
118+ ]
119+
111120 DeployStackSet : !Or [
112121 !Not [ !Equals [ !Ref BucketAccountId, !Ref "AWS::AccountId" ] ],
113122 !Not [ !Equals [ !Ref TopicAccountId, !Ref "AWS::AccountId" ] ]
@@ -118,10 +127,6 @@ Conditions:
118127 !Not [ !Condition DeployStackSet ]
119128 ]
120129
121- NeedKMSPolicy : !And [
122- !Not [ !Equals [ !Ref KMSKeyARN, "" ] ],
123- !Not [ !Equals [ !Ref KMSAccountId, !Ref BucketAccountId ] ]
124- ]
125130 IsTopicAccount : !Equals [ !Ref TopicAccountId, !Ref "AWS::AccountId" ]
126131
127132Resources :
0 commit comments