Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Amey-Deshmukh opened this issue Nov 14, 2019 · 2 comments
Labels
language/python Related to Python bindings needs-triage This issue or PR still needs to be triaged. p1

Comments

@Amey-Deshmukh
Copy link

Amey-Deshmukh commented Nov 14, 2019

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 aws-cdk@1.15) 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

@Amey-Deshmukh Amey-Deshmukh added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 14, 2019
@RomainMuller
Copy link
Contributor

Found a bug in the Python JSII runtime that is causing this behavior.

@RomainMuller RomainMuller added language/python Related to Python bindings p1 and removed bug This issue is a bug. labels Nov 14, 2019
RomainMuller added a commit to aws/jsii that referenced this issue Nov 14, 2019
The Dyanmic proxies were missing an implementation of `__setattr__`,
which caused setter invokations to not be forwarded to the `node`
process.

This is what causes aws/aws-cdk#5032
RomainMuller added a commit to aws/jsii that referenced this issue Nov 14, 2019
The Dyanmic proxies were missing an implementation of `__setattr__`,
which caused setter invokations to not be forwarded to the `node`
process.

This is what causes aws/aws-cdk#5032
@RomainMuller
Copy link
Contributor

Released jsii 0.20.6 which fixes the issue. You should be able to get the correct behavior by simply issuing:

pip install --upgrade jsii

Then make sure the installed version is >= 0.20.6 and the CreationPolicy should be synthesized again.

Apologies for the inconveniences this regression had caused!

mergify bot pushed a commit to aws/jsii that referenced this issue Nov 14, 2019
The Dyanmic proxies were missing an implementation of `__setattr__`,
which caused setter invokations to not be forwarded to the `node`
process.

This is what causes aws/aws-cdk#5032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/python Related to Python bindings needs-triage This issue or PR still needs to be triaged. p1
Projects
None yet
Development

No branches or pull requests

2 participants