You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The solution specific variables ${ACCOUNT_ID} and ${REGION} are not being replaced in JSON documents for KMS key policies deployed via the solution. This results in a pipeline failure in the logging stage.
Failure:
The stack named AWSAccelerator-LoggingStack-************-us-east-2 failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Policy contains a statement with one or more invalid principals. (Service: Kms, Status Code: 400
Snip-it from Key Policy Document { "Sid": "Allow EC2 to use this key on behalf of the current AWS Application Migration Service user, during target launches", "Effect": "Allow", "Principal": { "AWS": [ "arn:aws:iam::${ACCOUNT_ID}:root", "arn:aws:iam::${ACCOUNT_ID}:role/aws-service-role/mgn.amazonaws.com/AWSServiceRoleForApplicationMigrationService" ] }, "Action": [ "kms:ReEncrypt*", "kms:GenerateDataKey*" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": [ "${ACCOUNT_ID}" ], "kms:ViaService": "ec2.${REGION}.amazonaws.com" } } }
To Reproduce
Steps to reproduce the behavior.
Create a CMK for the solution and a custom KMS Key Policy
Utilize the solution specific variables ${ACCOUNT_ID} and ${REGION} within the Key Policy document.
Execute the pipeline
Expected behavior
I expected the pipeline to execute and replace the solution specific variables to be replaced with the AWS Account ID of the target account and the AWS Region the key policy is being deployed into.
This feature is supported per the Accelerator solution documentation
Describe the bug
The solution specific variables ${ACCOUNT_ID} and ${REGION} are not being replaced in JSON documents for KMS key policies deployed via the solution. This results in a pipeline failure in the logging stage.
Failure:
The stack named AWSAccelerator-LoggingStack-************-us-east-2 failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Policy contains a statement with one or more invalid principals. (Service: Kms, Status Code: 400
keyManagementService: keySets: - name: ExampleKey deploymentTargets: organizationalUnits: - Workloads/Prod alias: alias/example/key policy: kms/policy.json description: Example KMS key enabled: true enableKeyRotation: true removalPolicy: retain
Snip-it from Key Policy Document
{ "Sid": "Allow EC2 to use this key on behalf of the current AWS Application Migration Service user, during target launches", "Effect": "Allow", "Principal": { "AWS": [ "arn:aws:iam::${ACCOUNT_ID}:root", "arn:aws:iam::${ACCOUNT_ID}:role/aws-service-role/mgn.amazonaws.com/AWSServiceRoleForApplicationMigrationService" ] }, "Action": [ "kms:ReEncrypt*", "kms:GenerateDataKey*" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": [ "${ACCOUNT_ID}" ], "kms:ViaService": "ec2.${REGION}.amazonaws.com" } } }
To Reproduce
Steps to reproduce the behavior.
Expected behavior
I expected the pipeline to execute and replace the solution specific variables to be replaced with the AWS Account ID of the target account and the AWS Region the key policy is being deployed into.
This feature is supported per the Accelerator solution documentation
Please complete the following information about the solution:
Screenshots
If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information).
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: