aws-cloudformation/aws-cloudformation-macros

The S3Objects macro returns "Unrecognized resource types: [AWS::S3::Object]"

Closed this issue · 1 comments

There are several issues to get here.

  • The S3Objects macro does not contain a copy of deploy.sh. I copied it from the Count macro, which deployed the functions and the macro resource.
  • the file macro-template has to be renamed to template.yaml for deploy.sh to execute.
  • the resource function needs to be python3.6 not 2.7

Running this template

---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  ResourceFunction:
    Type: AWS::Serverless::Function
    Properties:
      Runtime: python3.6
      CodeUri: lambda
      Handler: resource.handler
      Policies: AmazonS3FullAccess

  MacroFunction:
    Type: AWS::Serverless::Function
    Properties:
      Runtime: python3.6
      CodeUri: lambda
      Handler: macro.handler
      Policies: AmazonS3FullAccess
      Environment:
        Variables:
          LAMBDA_ARN: !GetAtt ResourceFunction.Arn

  Macro:
    Type: AWS::CloudFormation::Macro
    Properties:
      Name: S3Objects
      FunctionName: !GetAtt MacroFunction.Arn

results in the error
aws cloudformation create-stack --stack-name bucket
-objects --template-body file://s3bucketa.yaml --capabilities CAPABILITY_AUTO_EXPAND
An error occurred (ValidationError) when calling the CreateStack operation: Template f
ormat error: Unrecognized resource types: [AWS::S3::Object]

I have made the changes in my cloned repo, but I haven't figured that unrecognized resource type yet. If I can figure it out, I will contribute the changes back. Would appreciate any assistance.

not sure what the problem was. i deleted the s3Objects macro-template/packaged template and started over. this error got resolved.