Using cfn-modules outside docker env

Hi,

following on from the book I am trying to run some of the cfn-modules examples up, with a view to customising them for our application. I have cloned the repo and followed the example commands but they all seem to fail on VPC creation, specifically on creating the subnets, with the message

 {
            "StackId": "arn:aws:cloudformation:eu-west-2:496345731537:stack/fargate-alb-single-container-example/62a382d0-62e4-11ea-8ae8-0a7f7081acf8",
            "EventId": "Vpc-CREATE_FAILED-2020-03-10T15:34:17.790Z",
            "StackName": "fargate-alb-single-container-example",
            "LogicalResourceId": "Vpc",
            "PhysicalResourceId": "arn:aws:cloudformation:eu-west-2:496345731537:stack/fargate-alb-single-container-example-Vpc-1N3C7PEEZ486L/762eb720-62e4-11ea-b835-060395953c4e",
            "ResourceType": "AWS::CloudFormation::Stack",
            "Timestamp": "2020-03-10T15:34:17.790000+00:00",
            "ResourceStatus": "CREATE_FAILED",
            "ResourceStatusReason": "Embedded stack arn:aws:cloudformation:eu-west-2:496345731537:stack/fargate-alb-single-container-example-Vpc-1N3C7PEEZ486L/762eb720-62e4-11ea-b835-060395953c4e was not successfully created: The following resource(s) failed to create: [SubnetBPrivate, SubnetAPrivate, SubnetAPublic, SubnetCPublic, SubnetCPrivate, SubnetBPublic]. ",
            "ResourceProperties": "{\"TemplateURL\":\"https://s3.eu-west-2.amazonaws.com/docker-on-aws-derbex/7f02bffc978183451b50c5619681ce0c.template\",\"Parameters\":{\"AlertingModule\":\"fargate-alb-single-container-example-Alerting-18SXWEM5M6PBL\",\"FlowLog\":\"false\",\"S3Endpoint\":\"false\",\"DynamoDBEndpoint\":\"false\",\"NatGateways\":\"false\"}}"
        },

my account has admin privileges, any ideas gratefully accepted.

hi!

could you check the error messages of the nested cloudformation stacks whre the subnets are created? there might be an issue with a missing availability zone.

Thanks
Michael

Hi Michael,

thanks for the reply, this seems to be error in the VPC stack

    {
        "StackId": "arn:aws:cloudformation:eu-west-2:496345731537:stack/fargate-alb-single-container-example-Vpc-11ZHK47JKFWKJ/8c234f40-6371-11ea-9cf3-02949b77ae4a",
        "EventId": "SubnetBPrivate-CREATE_FAILED-2020-03-11T08:24:05.808Z",
        "StackName": "fargate-alb-single-container-example-Vpc-11ZHK47JKFWKJ",
        "LogicalResourceId": "SubnetBPrivate",
        "PhysicalResourceId": "",
        "ResourceType": "AWS::CloudFormation::Stack",
        "Timestamp": "2020-03-11T08:24:05.808000+00:00",
        "ResourceStatus": "CREATE_FAILED",
        "ResourceStatusReason": "Template format error: YAML not well-formed. (line 62, column 16)",
        "ResourceProperties": "{\"TemplateURL\":\"https://s3.eu-west-2.amazonaws.com/docker-on-aws-derbex/b84a6b41a26a8a221609cb61eb28c45d.template\",\"Parameters\":{\"AZChar\":\"B\",\"Reach\":\"private\",\"SubnetCount\":\"6\",\"AZIndex\":\"1\",\"VpcPlainModule\":\"fargate-alb-single-container-example-Vpc-11ZHK47JKFWKJ-VpcPlain-NM0IAYHK0MQ0\",\"SubnetIndex\":\"3\"}}"
    },

I had a look in the template that was pushed to S3 and the offending section seems to be in the CIDR block here

Resources:

Subnet:
Type: AWS::EC2::Subnet
Properties:
AvailabilityZone:
Fn::Select:
- Ref: AZIndex
- Fn::GetAZs: ‘’
CidrBlock:
Fn::Select:
- Ref: SubnetIndex
- Fn::Cidr:
- {Fn::ImportValue: {Fn::Sub: ‘${VpcPlainModule}-CidrBlock’}}
- Ref: SubnetCount
- 12

What#s the version of AWS CLI you are using? Could you post the output of aws --version?

This might be related to https://github.com/cfn-modules/vpc-subnet/issues/1

It is version 2

aws-cli/2.0.2 Python/3.7.3 Linux/4.15.0-88-generic botocore/2.0.0dev6

Are you able to downgrade to v1 to see if that fixes the issue?

That fixes it.

I downgraded to aws-cli/1.18.18 Python/3.6.9 Linux/4.15.0-88-generic botocore/1.15.18

I have a couple of other questions, if you don’t mind, but I will raise them in new topics.