We have activated the CloudFormation Tag validation hook
aws --region us-west-2 cloudformation activate-type \
--type HOOK \
--type-name AWS::TagPolicies::TaggingComplianceValidator \
--publisher-id aws-hooks \
--auto-update \
--execution-role-arn
aws --region us-west-2 cloudformation set-type-configuration \
--type HOOK \
--type-name AWS::TagPolicies::TaggingComplianceValidator \
--configuration '{
"CloudFormationConfiguration": {
"HookConfiguration": {
"HookInvocationStatus": "ENABLED",
"FailureMode": "FAIL",
"TargetOperations": ["STACK"],
"Properties": {}
}
}
}'
along with a Tag policy to report missing required tags.
The hook works as expected if a stack is deployed via aws cloudformation create-stack cli command. Example of the hook running in WARN mode:

But if the stack is deployed via cdk deploy command - hook always fails with "Invalid cloudformation template format error." Example of the hook running in WARN mode:

Any idea what is going on, or any fix/workaround for this issue? We do need to continue using cdk cli for deployment.