Skip to content

CreationPolicy Attribute is not being generated in CFN template when using CDK version 1.16 #5032

Closed
@Amey-Deshmukh

Description

@Amey-Deshmukh

When using the CDK version 1.16, the CreationPolicy Attribute [] is not getting generated. This got created successfully when using CDK version 1.15 previously.

Also, forcing to use CDK version 1.15 accordingly (npm i -g [email protected]) gives the following error while performing '$cdk synth' -
"A newer version of the CDK CLI (>= 1.16.0) is necessary to interact with this app "

Reproduction Steps

Python Code Example:
inst = ec2.CfnInstance(self, id,
                       block_device_mappings=[
                           ec2.CfnInstance.BlockDeviceMappingProperty(device_name="/dev/sda1",
                                                                      ebs=ec2.CfnInstance.EbsProperty(
                                                                          delete_on_termination=True,
                                                                          volume_size=20,
                                                                          volume_type="gp2",
                                                                          encrypted=True)
                                                                      ),
                       ],
                       image_id=core.Fn.sub("${BuildAMI}"),
                       instance_initiated_shutdown_behavior="stop",
                       iam_instance_profile=params["IAMInstanceProfile"],
                       instance_type=params["GWInstanceSize"],
                       subnet_id=aws_az,
                       security_group_ids=[params["SecurityGroupId"], ],
                       tags=[core.Tag("Name", f"{env}-gateway"), ],
                       key_name=params["KeyName"]

                       )
inst.cfn_options.creation_policy = core.CfnCreationPolicy(
    resource_signal=core.CfnResourceSignal(timeout="PT55M"))`

Error Log

No error message for CDK version 1.16, but the Output template does not have CreationPolicy attribute as shown below -

GatewayInstance2576639B:
    Type: AWS::EC2::Instance
    Properties:
      BlockDeviceMappings:
        - DeviceName: /dev/sda1
          Ebs:
            DeleteOnTermination: true
            Encrypted: true
            VolumeSize: 20
            VolumeType: gp2
      IamInstanceProfile: xxxxxx
      ImageId: !Sub '${BuildAMI}'
      InstanceInitiatedShutdownBehavior: stop
      InstanceType: t3.medium
      KeyName: ---
      SecurityGroupIds:
        - sg-xxxxxxxxxxxxxxx
      SubnetId: subnet-xxxxxxxxxxxxxx
      Tags:
        - Key: Name
          Value: xxxxx-gateway

Also, the following error message is now being thrown when forcing CDK version 1.15 -
"A newer version of the CDK CLI (>= 1.16.0) is necessary to interact with this app "

Environment

  • CLI Version :
  • **Framework Version:**1.16
  • **OS :**Ubuntu
  • **Language :**Python

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

No one assigned

    Labels

    language/pythonRelated to Python bindingsneeds-triageThis issue or PR still needs to be triaged.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions