aws-cloudformation / aws-cloudformation-macros

This repository hosts examples of AWS CloudFormation macros.
Apache License 2.0
82 stars 49 forks source link

Explode macro fails with "Transform 1234567890::Explode failed without an error message" Error #7

Closed zechariahks closed 6 months ago

zechariahks commented 4 years ago

Issue Description:

If the template contains !Join or a plain list like "files:" property as mentioned below, Explode Transform fails with the error "Transform 1234567890::Explode failed without an error message".

Metadata:

    AWS::CloudFormation::Init:
      config:
        files:
          c:\cfn\cfn-hup.conf:
            content: !Join ['', [
              '[main]
              ',
              stack=, !Ref 'AWS::StackName', '
              ',
              region=, !Ref 'AWS::Region', '
              '
            ]]
          c:\cfn\hooks.d\cfn-auto-reloader.conf:
            content: !Join ['', [
              '[cfn-auto-reloader-hook]
              ',
              'triggers=post.update
              ',
              'path=Resources.LaunchConfiguration1.Metadata.AWS::CloudFormation::Init
              ',
              'action=cfn-init.exe -v -s ', !Ref 'AWS::StackId', ' -r LaunchConfiguration1',' --region ', !Ref 'AWS::Region', '
              '
            ]]
        services:
          windows:
            cfn-hup:
              enabled: 'true'
              ensureRunning: 'true'
              files:
                - c:\cfn\cfn-hup.conf
                - c:\etc\cfn\hooks.d\cfn-auto-reloader.conf

While debugging the issue, I found that this is because when walk_resource function get executed for the above properties, resource.items() here throws below error.

for key, value in resource.items(): AttributeError: 'str' object has no attribute 'items'

Reproduction Steps:

ericzbeard commented 6 months ago

We are archiving this repository in favor of similar content located here: https://github.com/aws-cloudformation/aws-cloudformation-templates/tree/main/aws/services/CloudFormation/MacrosExamples