Last active
February 14, 2025 02:25
-
-
Save PatMyron/c1940c37d2a6fea0fa950a107d485b81 to your computer and use it in GitHub Desktop.
Template format error: Unrecognized resource types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parameters: | |
CreateResource: | |
Default: false | |
Type: String | |
AllowedValues: [true, false] | |
Conditions: | |
ShouldCreateResource: | |
!Equals [true, !Ref CreateResource] | |
Resources: | |
Macro: | |
Type: AWS::CloudFormation::Macro | |
Properties: | |
FunctionName: !Ref Function | |
Name: macro | |
Function: | |
Type: AWS::Lambda::Function | |
Properties: | |
Runtime: python3.7 | |
Role: !GetAtt Role.Arn | |
Code: | |
ZipFile: | | |
def lambda_handler(event, context): | |
if event['params']['CreateResource'] == 'false': | |
return {'fragment': {'Type': 'AWS::CloudFormation::WaitConditionHandle'}, | |
'requestId': event['requestId'], | |
'status': 'success'} | |
else: | |
return {'fragment': event['fragment'], | |
'requestId': event['requestId'], | |
'status': 'success'} | |
Handler: index.lambda_handler | |
Role: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Action: sts:AssumeRole | |
Principal: | |
Service: lambda.amazonaws.com | |
Stack: | |
Fn::Transform: # add these lines in another commit after the macro | |
Name: macro # add these lines in another commit after the macro | |
Parameters: # add these lines in another commit after the macro | |
CreateResource: !Ref CreateResource # add these lines in another commit after the macro | |
Type: AWS::AppStream::Stack | |
Condition: ShouldCreateResource |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
validate-template
/get-template-summary
/create-stack-set
andcreate-stack
/update-stack
through the console throw:Template format error: Unrecognized resource types: []
create-change-set --change-set-type IMPORT
has similar console issueshttps://code.amazon.com/packages/AWS21StackBuilderService/blobs/74ba401db270b8329b602a3218f0bb608a2e74f7/--/src/amzn/aws21/sbs/utils/ResourceTypeValidator.java#L22
Should not throw this error where we cannot evaluate conditions
Current workaround of adding transforms like
Transform: AWS::Serverless-2016-10-31
to templates:https://stackoverflow.com/q/48228751/cloudformation-conditional-template-validation/69591806#69591806