aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.67k stars 3.92k forks source link

(aws_cdk.aws_ec2/CfnTransitGatewayAttachment): parameters in OptionsProperty are not supported #27344

Closed shawnxue closed 1 year ago

shawnxue commented 1 year ago

Describe the bug

When attaching a vpc to transit gateway in AWS CDK (python), we found that keys in OptionsProperty are not supported. CDK version: aws-cdk-lib==2.93.0 Here is our code

tgw_vpc = CfnTransitGatewayAttachment(
            self,
            "attachVPCToTransitGateway",
            subnet_ids=my_vpc.select_subnets(subnet_group_name='private_subnet').subnet_ids,
            transit_gateway_id=my_tgw.attr_id,
            vpc_id=my_vpc.vpc_id,
            options=CfnTransitGatewayAttachment.OptionsProperty(
                appliance_mode_support="disable",
                dns_support="enable",
                ipv6_support="disable"
            )
        )

Errors we got:

#/Options: extraneous key [dnsSupport] is not permitted
#/Options: extraneous key [ipv6Support] is not permitted
#/Options: extraneous key [applianceModeSupport] is not permitted
    at FullCloudFormationDeployment.monitorDeployment (/opt/hostedtoolcache/node/18.0.0/x64/lib/node_modules/aws-cdk/lib/index.js:467:10232)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/opt/hostedtoolcache/node/18.0.0/x64/lib/node_modules/aws-cdk/lib/index.js:470:179911)
    at async /opt/hostedtoolcache/node/18.0.0/x64/lib/node_modules/aws-cdk/lib/index.js:470:163159

Expected Behavior

parameters in OptionsProperty are supported.

Current Behavior

We got errors when applying the code: Errors we got:

#/Options: extraneous key [dnsSupport] is not permitted
#/Options: extraneous key [ipv6Support] is not permitted
#/Options: extraneous key [applianceModeSupport] is not permitted
    at FullCloudFormationDeployment.monitorDeployment (/opt/hostedtoolcache/node/18.0.0/x64/lib/node_modules/aws-cdk/lib/index.js:467:10232)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/opt/hostedtoolcache/node/18.0.0/x64/lib/node_modules/aws-cdk/lib/index.js:470:179911)
    at async /opt/hostedtoolcache/node/18.0.0/x64/lib/node_modules/aws-cdk/lib/index.js:470:163159

Reproduction Steps

  1. create a transit gateway with CfnTransitGateway
  2. create a transit gateway attachment with CfnTransitGatewayAttachment
  3. apply the code with cdk deploy
  4. You will get the errors above.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.86.0 (build 1130fab)

Framework Version

No response

Node.js Version

18.0.0

OS

22.04 LTS

Language

Python

Language Version

3.9

Other information

No response

peterwoodworth commented 1 year ago

Options takes in any, not OptionsProperty. Fill it out directly without that (and be sure to PascalCase the keys) and this will work fine.

Ping me if you need to see an example of this

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.