diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets.json new file mode 100644 index 0000000000000..ff106bdf98554 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets.json @@ -0,0 +1,19 @@ +{ + "version": "32.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/cdk.out new file mode 100644 index 0000000000000..f0b901e7c06e5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/integ.json new file mode 100644 index 0000000000000..8149c06410641 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "32.0.0", + "testCases": { + "appmesh-routes-port-matchers/DefaultTest": { + "stacks": [ + "mesh-stack" + ], + "assertionStack": "appmesh-routes-port-matchers/DefaultTest/DeployAssert", + "assertionStackName": "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/manifest.json new file mode 100644 index 0000000000000..00a9fa201822e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/manifest.json @@ -0,0 +1,315 @@ +{ + "version": "32.0.0", + "artifacts": { + "mesh-stack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "mesh-stack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "mesh-stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "mesh-stack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/22240821b1bd2dffca97a9e0b581bf2d1a2dc32765da9872c066c10f315cd391.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "mesh-stack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "mesh-stack.assets" + ], + "metadata": { + "/mesh-stack/vpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcA2121C38" + } + ], + "/mesh-stack/vpc/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet1Subnet2E65531E" + } + ], + "/mesh-stack/vpc/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet1RouteTable48A2DF9B" + } + ], + "/mesh-stack/vpc/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet1RouteTableAssociation5D3F4579" + } + ], + "/mesh-stack/vpc/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet1DefaultRoute10708846" + } + ], + "/mesh-stack/vpc/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet1EIPDA49DCBE" + } + ], + "/mesh-stack/vpc/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet1NATGateway9C16659E" + } + ], + "/mesh-stack/vpc/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet2Subnet009B674F" + } + ], + "/mesh-stack/vpc/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet2RouteTableEB40D4CB" + } + ], + "/mesh-stack/vpc/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet2RouteTableAssociation21F81B59" + } + ], + "/mesh-stack/vpc/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPublicSubnet2DefaultRouteA1EC0F60" + } + ], + "/mesh-stack/vpc/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet1Subnet934893E8" + } + ], + "/mesh-stack/vpc/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet1RouteTableB41A48CC" + } + ], + "/mesh-stack/vpc/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet1RouteTableAssociation67945127" + } + ], + "/mesh-stack/vpc/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet1DefaultRoute1AA8E2E5" + } + ], + "/mesh-stack/vpc/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet2Subnet7031C2BA" + } + ], + "/mesh-stack/vpc/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet2RouteTable7280F23E" + } + ], + "/mesh-stack/vpc/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet2RouteTableAssociation007E94D3" + } + ], + "/mesh-stack/vpc/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcPrivateSubnet2DefaultRouteB0E07F99" + } + ], + "/mesh-stack/vpc/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcIGWE57CBDCA" + } + ], + "/mesh-stack/vpc/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "vpcVPCGW7984C166" + } + ], + "/mesh-stack/test-namespace/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testnamespace01FA2CAF" + } + ], + "/mesh-stack/mesh/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshACDFE68E" + } + ], + "/mesh-stack/mesh/http-router/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshhttprouter1DC8881A" + } + ], + "/mesh-stack/mesh/http-router/http-route/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshhttprouterhttprouteA1EC61B9" + } + ], + "/mesh-stack/mesh/grpc-router/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgrpcrouter885C4D83" + } + ], + "/mesh-stack/mesh/grpc-router/grpc-route/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgrpcroutergrpcrouteC2C69C40" + } + ], + "/mesh-stack/mesh/http-node/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshhttpnode26144F8B" + } + ], + "/mesh-stack/mesh/grpc-node/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgrpcnode5DE90B75" + } + ], + "/mesh-stack/mesh/gateway/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgateway7E10276F" + } + ], + "/mesh-stack/mesh/gateway/gateway-route-http/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgatewaygatewayroutehttpFC878A78" + } + ], + "/mesh-stack/mesh/gateway2/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgateway2A278D68E" + } + ], + "/mesh-stack/mesh/gateway2/gateway2-route-grpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "meshgateway2gateway2routegrpcD0DA968B" + } + ], + "/mesh-stack/http-service/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "httpserviceA998E5F0" + } + ], + "/mesh-stack/grpc-service/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "grpcserviceF42BA24D" + } + ], + "/mesh-stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/mesh-stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "mesh-stack" + }, + "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "appmeshroutesportmatchersDefaultTestDeployAssert40D7C50D.assets" + ], + "metadata": { + "/appmesh-routes-port-matchers/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/appmesh-routes-port-matchers/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "appmesh-routes-port-matchers/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/mesh-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/mesh-stack.assets.json new file mode 100644 index 0000000000000..df0d9477bb792 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/mesh-stack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "32.0.0", + "files": { + "22240821b1bd2dffca97a9e0b581bf2d1a2dc32765da9872c066c10f315cd391": { + "source": { + "path": "mesh-stack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "22240821b1bd2dffca97a9e0b581bf2d1a2dc32765da9872c066c10f315cd391.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/mesh-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/mesh-stack.template.json new file mode 100644 index 0000000000000..6f1dbba1aee62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/mesh-stack.template.json @@ -0,0 +1,767 @@ +{ + "Resources": { + "vpcA2121C38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc" + } + ] + } + }, + "vpcPublicSubnet1Subnet2E65531E": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "vpcPublicSubnet1RouteTable48A2DF9B": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "vpcPublicSubnet1RouteTableAssociation5D3F4579": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" + }, + "SubnetId": { + "Ref": "vpcPublicSubnet1Subnet2E65531E" + } + } + }, + "vpcPublicSubnet1DefaultRoute10708846": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "vpcIGWE57CBDCA" + } + }, + "DependsOn": [ + "vpcVPCGW7984C166" + ] + }, + "vpcPublicSubnet1EIPDA49DCBE": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "vpcPublicSubnet1NATGateway9C16659E": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "vpcPublicSubnet1Subnet2E65531E" + }, + "AllocationId": { + "Fn::GetAtt": [ + "vpcPublicSubnet1EIPDA49DCBE", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "vpcPublicSubnet1DefaultRoute10708846", + "vpcPublicSubnet1RouteTableAssociation5D3F4579" + ] + }, + "vpcPublicSubnet2Subnet009B674F": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "mesh-stack/vpc/PublicSubnet2" + } + ] + } + }, + "vpcPublicSubnet2RouteTableEB40D4CB": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc/PublicSubnet2" + } + ] + } + }, + "vpcPublicSubnet2RouteTableAssociation21F81B59": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" + }, + "SubnetId": { + "Ref": "vpcPublicSubnet2Subnet009B674F" + } + } + }, + "vpcPublicSubnet2DefaultRouteA1EC0F60": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "vpcIGWE57CBDCA" + } + }, + "DependsOn": [ + "vpcVPCGW7984C166" + ] + }, + "vpcPrivateSubnet1Subnet934893E8": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "mesh-stack/vpc/PrivateSubnet1" + } + ] + } + }, + "vpcPrivateSubnet1RouteTableB41A48CC": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc/PrivateSubnet1" + } + ] + } + }, + "vpcPrivateSubnet1RouteTableAssociation67945127": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" + }, + "SubnetId": { + "Ref": "vpcPrivateSubnet1Subnet934893E8" + } + } + }, + "vpcPrivateSubnet1DefaultRoute1AA8E2E5": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "vpcPublicSubnet1NATGateway9C16659E" + } + } + }, + "vpcPrivateSubnet2Subnet7031C2BA": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "mesh-stack/vpc/PrivateSubnet2" + } + ] + } + }, + "vpcPrivateSubnet2RouteTable7280F23E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc/PrivateSubnet2" + } + ] + } + }, + "vpcPrivateSubnet2RouteTableAssociation007E94D3": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "vpcPrivateSubnet2RouteTable7280F23E" + }, + "SubnetId": { + "Ref": "vpcPrivateSubnet2Subnet7031C2BA" + } + } + }, + "vpcPrivateSubnet2DefaultRouteB0E07F99": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "vpcPrivateSubnet2RouteTable7280F23E" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "vpcPublicSubnet1NATGateway9C16659E" + } + } + }, + "vpcIGWE57CBDCA": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "mesh-stack/vpc" + } + ] + } + }, + "vpcVPCGW7984C166": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "vpcA2121C38" + }, + "InternetGatewayId": { + "Ref": "vpcIGWE57CBDCA" + } + } + }, + "testnamespace01FA2CAF": { + "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", + "Properties": { + "Name": "domain.local", + "Vpc": { + "Ref": "vpcA2121C38" + } + } + }, + "meshACDFE68E": { + "Type": "AWS::AppMesh::Mesh", + "Properties": { + "MeshName": "meshstackmesh680D3CEB", + "Spec": {} + } + }, + "meshhttprouter1DC8881A": { + "Type": "AWS::AppMesh::VirtualRouter", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Listeners": [ + { + "PortMapping": { + "Port": 1233, + "Protocol": "http" + } + } + ] + }, + "VirtualRouterName": "meshstackmeshhttprouter85E0114B" + } + }, + "meshhttprouterhttprouteA1EC61B9": { + "Type": "AWS::AppMesh::Route", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "HttpRoute": { + "Action": { + "WeightedTargets": [ + { + "VirtualNode": { + "Fn::GetAtt": [ + "meshhttpnode26144F8B", + "VirtualNodeName" + ] + }, + "Weight": 1 + } + ] + }, + "Match": { + "Port": 1233, + "Prefix": "/" + } + } + }, + "VirtualRouterName": { + "Fn::GetAtt": [ + "meshhttprouter1DC8881A", + "VirtualRouterName" + ] + }, + "RouteName": "http-route" + } + }, + "meshgrpcrouter885C4D83": { + "Type": "AWS::AppMesh::VirtualRouter", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Listeners": [ + { + "PortMapping": { + "Port": 1234, + "Protocol": "grpc" + } + } + ] + }, + "VirtualRouterName": "meshstackmeshgrpcrouter2CCBF824" + } + }, + "meshgrpcroutergrpcrouteC2C69C40": { + "Type": "AWS::AppMesh::Route", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "GrpcRoute": { + "Action": { + "WeightedTargets": [ + { + "VirtualNode": { + "Fn::GetAtt": [ + "meshgrpcnode5DE90B75", + "VirtualNodeName" + ] + }, + "Weight": 1 + } + ] + }, + "Match": { + "Port": 1234 + } + } + }, + "VirtualRouterName": { + "Fn::GetAtt": [ + "meshgrpcrouter885C4D83", + "VirtualRouterName" + ] + }, + "RouteName": "grpc-route" + } + }, + "meshhttpnode26144F8B": { + "Type": "AWS::AppMesh::VirtualNode", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Listeners": [ + { + "PortMapping": { + "Port": 1233, + "Protocol": "http" + } + } + ], + "ServiceDiscovery": { + "DNS": { + "Hostname": "node.domain.local", + "ResponseType": "ENDPOINTS" + } + } + }, + "VirtualNodeName": "meshstackmeshhttpnodeECE697CA" + } + }, + "meshgrpcnode5DE90B75": { + "Type": "AWS::AppMesh::VirtualNode", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Listeners": [ + { + "PortMapping": { + "Port": 1234, + "Protocol": "grpc" + } + } + ], + "ServiceDiscovery": { + "DNS": { + "Hostname": "node.domain.local", + "ResponseType": "ENDPOINTS" + } + } + }, + "VirtualNodeName": "meshstackmeshgrpcnode22C47BCC" + } + }, + "meshgateway7E10276F": { + "Type": "AWS::AppMesh::VirtualGateway", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Listeners": [ + { + "PortMapping": { + "Port": 1233, + "Protocol": "http" + } + } + ], + "Logging": { + "AccessLog": { + "File": { + "Path": "/dev/stdout" + } + } + } + }, + "VirtualGatewayName": "gateway" + } + }, + "meshgatewaygatewayroutehttpFC878A78": { + "Type": "AWS::AppMesh::GatewayRoute", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "HttpRoute": { + "Action": { + "Target": { + "VirtualService": { + "VirtualServiceName": { + "Fn::GetAtt": [ + "httpserviceA998E5F0", + "VirtualServiceName" + ] + } + } + } + }, + "Match": { + "Port": 1233, + "Prefix": "/" + } + } + }, + "VirtualGatewayName": { + "Fn::GetAtt": [ + "meshgateway7E10276F", + "VirtualGatewayName" + ] + }, + "GatewayRouteName": "meshstackmeshgatewaygatewayroutehttp4CA31BCC" + } + }, + "meshgateway2A278D68E": { + "Type": "AWS::AppMesh::VirtualGateway", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Listeners": [ + { + "PortMapping": { + "Port": 1234, + "Protocol": "grpc" + } + } + ], + "Logging": { + "AccessLog": { + "File": { + "Path": "/dev/stdout" + } + } + } + }, + "VirtualGatewayName": "gateway2" + } + }, + "meshgateway2gateway2routegrpcD0DA968B": { + "Type": "AWS::AppMesh::GatewayRoute", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "GrpcRoute": { + "Action": { + "Target": { + "VirtualService": { + "VirtualServiceName": { + "Fn::GetAtt": [ + "grpcserviceF42BA24D", + "VirtualServiceName" + ] + } + } + } + }, + "Match": { + "Port": 1234 + } + } + }, + "VirtualGatewayName": { + "Fn::GetAtt": [ + "meshgateway2A278D68E", + "VirtualGatewayName" + ] + }, + "GatewayRouteName": "meshstackmeshgateway2gateway2routegrpc65A85E78" + } + }, + "httpserviceA998E5F0": { + "Type": "AWS::AppMesh::VirtualService", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Provider": { + "VirtualRouter": { + "VirtualRouterName": { + "Fn::GetAtt": [ + "meshhttprouter1DC8881A", + "VirtualRouterName" + ] + } + } + } + }, + "VirtualServiceName": "service1.domain.local" + } + }, + "grpcserviceF42BA24D": { + "Type": "AWS::AppMesh::VirtualService", + "Properties": { + "MeshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "Spec": { + "Provider": { + "VirtualRouter": { + "VirtualRouterName": { + "Fn::GetAtt": [ + "meshgrpcrouter885C4D83", + "VirtualRouterName" + ] + } + } + } + }, + "VirtualServiceName": "service2.domain.local" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/tree.json new file mode 100644 index 0000000000000..8e7f15fecfb80 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.js.snapshot/tree.json @@ -0,0 +1,1322 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "mesh-stack": { + "id": "mesh-stack", + "path": "mesh-stack", + "children": { + "vpc": { + "id": "vpc", + "path": "mesh-stack/vpc", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/vpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "mesh-stack/vpc/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "mesh-stack/vpc/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "mesh-stack/vpc/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "mesh-stack/vpc/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "mesh-stack/vpc/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" + }, + "subnetId": { + "Ref": "vpcPublicSubnet1Subnet2E65531E" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "mesh-stack/vpc/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "vpcIGWE57CBDCA" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "mesh-stack/vpc/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "mesh-stack/vpc/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "vpcPublicSubnet1Subnet2E65531E" + }, + "allocationId": { + "Fn::GetAtt": [ + "vpcPublicSubnet1EIPDA49DCBE", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "mesh-stack/vpc/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "mesh-stack/vpc/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "mesh-stack/vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "mesh-stack/vpc/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "mesh-stack/vpc/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "mesh-stack/vpc/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" + }, + "subnetId": { + "Ref": "vpcPublicSubnet2Subnet009B674F" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "mesh-stack/vpc/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "vpcIGWE57CBDCA" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "mesh-stack/vpc/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "mesh-stack/vpc/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "mesh-stack/vpc/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "mesh-stack/vpc/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "mesh-stack/vpc/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "mesh-stack/vpc/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" + }, + "subnetId": { + "Ref": "vpcPrivateSubnet1Subnet934893E8" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "mesh-stack/vpc/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "vpcPublicSubnet1NATGateway9C16659E" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "mesh-stack/vpc/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "mesh-stack/vpc/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "mesh-stack/vpc/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "mesh-stack/vpc/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "mesh-stack/vpc/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "mesh-stack/vpc/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPrivateSubnet2RouteTable7280F23E" + }, + "subnetId": { + "Ref": "vpcPrivateSubnet2Subnet7031C2BA" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "mesh-stack/vpc/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "vpcPrivateSubnet2RouteTable7280F23E" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "vpcPublicSubnet1NATGateway9C16659E" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "mesh-stack/vpc/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "mesh-stack/vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "mesh-stack/vpc/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "vpcA2121C38" + }, + "internetGatewayId": { + "Ref": "vpcIGWE57CBDCA" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "test-namespace": { + "id": "test-namespace", + "path": "mesh-stack/test-namespace", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/test-namespace/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::PrivateDnsNamespace", + "aws:cdk:cloudformation:props": { + "name": "domain.local", + "vpc": { + "Ref": "vpcA2121C38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_servicediscovery.CfnPrivateDnsNamespace", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_servicediscovery.PrivateDnsNamespace", + "version": "0.0.0" + } + }, + "mesh": { + "id": "mesh", + "path": "mesh-stack/mesh", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::Mesh", + "aws:cdk:cloudformation:props": { + "meshName": "meshstackmesh680D3CEB", + "spec": {} + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnMesh", + "version": "0.0.0" + } + }, + "http-router": { + "id": "http-router", + "path": "mesh-stack/mesh/http-router", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/http-router/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "listeners": [ + { + "portMapping": { + "port": 1233, + "protocol": "http" + } + } + ] + }, + "virtualRouterName": "meshstackmeshhttprouter85E0114B" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualRouter", + "version": "0.0.0" + } + }, + "http-route": { + "id": "http-route", + "path": "mesh-stack/mesh/http-router/http-route", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/http-router/http-route/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "httpRoute": { + "action": { + "weightedTargets": [ + { + "virtualNode": { + "Fn::GetAtt": [ + "meshhttpnode26144F8B", + "VirtualNodeName" + ] + }, + "weight": 1 + } + ] + }, + "match": { + "prefix": "/", + "port": 1233 + } + } + }, + "virtualRouterName": { + "Fn::GetAtt": [ + "meshhttprouter1DC8881A", + "VirtualRouterName" + ] + }, + "routeName": "http-route" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.Route", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualRouter", + "version": "0.0.0" + } + }, + "grpc-router": { + "id": "grpc-router", + "path": "mesh-stack/mesh/grpc-router", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/grpc-router/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "listeners": [ + { + "portMapping": { + "port": 1234, + "protocol": "grpc" + } + } + ] + }, + "virtualRouterName": "meshstackmeshgrpcrouter2CCBF824" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualRouter", + "version": "0.0.0" + } + }, + "grpc-route": { + "id": "grpc-route", + "path": "mesh-stack/mesh/grpc-router/grpc-route", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/grpc-router/grpc-route/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "grpcRoute": { + "action": { + "weightedTargets": [ + { + "virtualNode": { + "Fn::GetAtt": [ + "meshgrpcnode5DE90B75", + "VirtualNodeName" + ] + }, + "weight": 1 + } + ] + }, + "match": { + "port": 1234 + } + } + }, + "virtualRouterName": { + "Fn::GetAtt": [ + "meshgrpcrouter885C4D83", + "VirtualRouterName" + ] + }, + "routeName": "grpc-route" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.Route", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualRouter", + "version": "0.0.0" + } + }, + "http-node": { + "id": "http-node", + "path": "mesh-stack/mesh/http-node", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/http-node/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "listeners": [ + { + "portMapping": { + "port": 1233, + "protocol": "http" + } + } + ], + "serviceDiscovery": { + "dns": { + "hostname": "node.domain.local", + "responseType": "ENDPOINTS" + } + } + }, + "virtualNodeName": "meshstackmeshhttpnodeECE697CA" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualNode", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualNode", + "version": "0.0.0" + } + }, + "grpc-node": { + "id": "grpc-node", + "path": "mesh-stack/mesh/grpc-node", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/grpc-node/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "listeners": [ + { + "portMapping": { + "port": 1234, + "protocol": "grpc" + } + } + ], + "serviceDiscovery": { + "dns": { + "hostname": "node.domain.local", + "responseType": "ENDPOINTS" + } + } + }, + "virtualNodeName": "meshstackmeshgrpcnode22C47BCC" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualNode", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualNode", + "version": "0.0.0" + } + }, + "gateway": { + "id": "gateway", + "path": "mesh-stack/mesh/gateway", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/gateway/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualGateway", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "listeners": [ + { + "portMapping": { + "port": 1233, + "protocol": "http" + } + } + ], + "logging": { + "accessLog": { + "file": { + "path": "/dev/stdout" + } + } + } + }, + "virtualGatewayName": "gateway" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualGateway", + "version": "0.0.0" + } + }, + "gateway-route-http": { + "id": "gateway-route-http", + "path": "mesh-stack/mesh/gateway/gateway-route-http", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/gateway/gateway-route-http/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::GatewayRoute", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "httpRoute": { + "match": { + "prefix": "/", + "port": 1233 + }, + "action": { + "target": { + "virtualService": { + "virtualServiceName": { + "Fn::GetAtt": [ + "httpserviceA998E5F0", + "VirtualServiceName" + ] + } + } + } + } + } + }, + "virtualGatewayName": { + "Fn::GetAtt": [ + "meshgateway7E10276F", + "VirtualGatewayName" + ] + }, + "gatewayRouteName": "meshstackmeshgatewaygatewayroutehttp4CA31BCC" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnGatewayRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.GatewayRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualGateway", + "version": "0.0.0" + } + }, + "gateway2": { + "id": "gateway2", + "path": "mesh-stack/mesh/gateway2", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/gateway2/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualGateway", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "listeners": [ + { + "portMapping": { + "port": 1234, + "protocol": "grpc" + } + } + ], + "logging": { + "accessLog": { + "file": { + "path": "/dev/stdout" + } + } + } + }, + "virtualGatewayName": "gateway2" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualGateway", + "version": "0.0.0" + } + }, + "gateway2-route-grpc": { + "id": "gateway2-route-grpc", + "path": "mesh-stack/mesh/gateway2/gateway2-route-grpc", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/mesh/gateway2/gateway2-route-grpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::GatewayRoute", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "grpcRoute": { + "match": { + "port": 1234 + }, + "action": { + "target": { + "virtualService": { + "virtualServiceName": { + "Fn::GetAtt": [ + "grpcserviceF42BA24D", + "VirtualServiceName" + ] + } + } + } + } + } + }, + "virtualGatewayName": { + "Fn::GetAtt": [ + "meshgateway2A278D68E", + "VirtualGatewayName" + ] + }, + "gatewayRouteName": "meshstackmeshgateway2gateway2routegrpc65A85E78" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnGatewayRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.GatewayRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.Mesh", + "version": "0.0.0" + } + }, + "http-service": { + "id": "http-service", + "path": "mesh-stack/http-service", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/http-service/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "provider": { + "virtualRouter": { + "virtualRouterName": { + "Fn::GetAtt": [ + "meshhttprouter1DC8881A", + "VirtualRouterName" + ] + } + } + } + }, + "virtualServiceName": "service1.domain.local" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualService", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualService", + "version": "0.0.0" + } + }, + "grpc-service": { + "id": "grpc-service", + "path": "mesh-stack/grpc-service", + "children": { + "Resource": { + "id": "Resource", + "path": "mesh-stack/grpc-service/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", + "aws:cdk:cloudformation:props": { + "meshName": { + "Fn::GetAtt": [ + "meshACDFE68E", + "MeshName" + ] + }, + "spec": { + "provider": { + "virtualRouter": { + "virtualRouterName": { + "Fn::GetAtt": [ + "meshgrpcrouter885C4D83", + "VirtualRouterName" + ] + } + } + } + }, + "virtualServiceName": "service2.domain.local" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.CfnVirtualService", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_appmesh.VirtualService", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "mesh-stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "mesh-stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "appmesh-routes-port-matchers": { + "id": "appmesh-routes-port-matchers", + "path": "appmesh-routes-port-matchers", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "appmesh-routes-port-matchers/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "appmesh-routes-port-matchers/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.26" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "appmesh-routes-port-matchers/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "appmesh-routes-port-matchers/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "appmesh-routes-port-matchers/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.26" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.ts new file mode 100644 index 0000000000000..083fb9f72240a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh-port-match.ts @@ -0,0 +1,121 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cloudmap from 'aws-cdk-lib/aws-servicediscovery'; +import * as cdk from 'aws-cdk-lib'; +import * as appmesh from 'aws-cdk-lib/aws-appmesh'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +export const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'mesh-stack', {}); + +new IntegTest(app, 'appmesh-routes-port-matchers', { + testCases: [stack], +}); + +const vpc = new ec2.Vpc(stack, 'vpc', { + restrictDefaultSecurityGroup: false, + natGateways: 1, +}); + +const namespace = new cloudmap.PrivateDnsNamespace(stack, 'test-namespace', { + vpc, + name: 'domain.local', +}); + +const mesh = new appmesh.Mesh(stack, 'mesh'); + +const httpRouter = mesh.addVirtualRouter('http-router', { + listeners: [ + appmesh.VirtualRouterListener.http(1233), + ], +}); + +const grpcRouter = mesh.addVirtualRouter('grpc-router', { + listeners: [ + appmesh.VirtualRouterListener.grpc(1234), + ], +}); + +const httpNode = mesh.addVirtualNode('http-node', { + serviceDiscovery: appmesh.ServiceDiscovery.dns(`node.${namespace.namespaceName}`, appmesh.DnsResponseType.ENDPOINTS), + listeners: [ + appmesh.VirtualNodeListener.http({ + port: 1233, + }), + ], +}); + +const grpcNode = mesh.addVirtualNode('grpc-node', { + serviceDiscovery: appmesh.ServiceDiscovery.dns(`node.${namespace.namespaceName}`, appmesh.DnsResponseType.ENDPOINTS), + listeners: [ + appmesh.VirtualNodeListener.grpc({ + port: 1234, + }), + ], +}); + +httpRouter.addRoute('http-route', { + routeSpec: appmesh.RouteSpec.http({ + weightedTargets: [{ virtualNode: httpNode }], + match: { + port: 1233, + }, + }), +}); + +grpcRouter.addRoute('grpc-route', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [{ virtualNode: grpcNode }], + match: { + port: 1234, + }, + }), +}); + +const httpVirtualService = new appmesh.VirtualService(stack, 'http-service', { + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(httpRouter), + virtualServiceName: 'service1.domain.local', +}); + +const grpcVirtualService = new appmesh.VirtualService(stack, 'grpc-service', { + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(grpcRouter), + virtualServiceName: 'service2.domain.local', +}); + +const gateway = mesh.addVirtualGateway('gateway', { + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), + virtualGatewayName: 'gateway', + listeners: [ + appmesh.VirtualGatewayListener.http({ + port: 1233, + }), + ], +}); + +gateway.addGatewayRoute('gateway-route-http', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: httpVirtualService, + match: { + port: 1233, + }, + }), +}); + +const gateway2 = mesh.addVirtualGateway('gateway2', { + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), + virtualGatewayName: 'gateway2', + listeners: [ + appmesh.VirtualGatewayListener.grpc({ + port: 1234, + }), + ], +}); + +gateway2.addGatewayRoute('gateway2-route-grpc', { + routeSpec: appmesh.GatewayRouteSpec.grpc({ + routeTarget: grpcVirtualService, + match: { + port: 1234, + }, + }), +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json index b55525c6fddbe..0eed220c5c962 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json @@ -141,7 +141,7 @@ "path": "cdk-integ-auto-delete-images/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.26" } }, "DeployAssert": { @@ -187,7 +187,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.270" + "version": "10.2.26" } } }, diff --git a/packages/aws-cdk-lib/aws-appmesh/README.md b/packages/aws-cdk-lib/aws-appmesh/README.md index 7bab23e235586..fb1eefa3d4536 100644 --- a/packages/aws-cdk-lib/aws-appmesh/README.md +++ b/packages/aws-cdk-lib/aws-appmesh/README.md @@ -673,6 +673,26 @@ router.addRoute('route-grpc-retry', { }); ``` +Add a gRPC route that matches based on port: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-grpc-port', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [ + { + virtualNode: node, + }, + ], + match: { + port: 1234, + }, + }), +}); +``` + Add a gRPC route with timeout: ```ts @@ -779,7 +799,7 @@ gateway.addGatewayRoute('gateway-route-http', { }); ``` -For gRPC-based gateway routes, the `match` field can be used to match on service name, host name, and metadata. +For gRPC-based gateway routes, the `match` field can be used to match on service name, host name, port and metadata. ```ts declare const gateway: appmesh.VirtualGateway; diff --git a/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts b/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts index 2e430baf64d51..dffd856f1698b 100644 --- a/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts @@ -150,6 +150,13 @@ export interface GrpcGatewayRouteMatch { * @default true */ readonly rewriteRequestHostname?: boolean; + + /** + * The port to match from the request. + * + * @default - do not match on port + */ + readonly port?: number; } /** @@ -365,6 +372,7 @@ class GrpcGatewayRouteSpec extends GatewayRouteSpec { match: { serviceName: this.match.serviceName, hostname: this.match.hostname?.bind(scope).hostnameMatch, + port: this.match.port, metadata: metadataMatch?.map(metadata => metadata.bind(scope).headerMatch), }, action: { diff --git a/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts b/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts index 48dc490e29a9c..3493fabe78d37 100644 --- a/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts @@ -126,7 +126,7 @@ export function validateGrpcMatchArrayLength(metadata?: HeaderMatch[]): void { * This is the helper method to validate at least one of gRPC route match type is defined. */ export function validateGrpcRouteMatch(match: GrpcRouteMatch): void { - if (match.serviceName === undefined && match.metadata === undefined && match.methodName === undefined) { + if (match.serviceName === undefined && match.metadata === undefined && match.methodName === undefined && match.port === undefined) { throw new Error('At least one gRPC route match property must be provided'); } } @@ -135,7 +135,7 @@ export function validateGrpcRouteMatch(match: GrpcRouteMatch): void { * This is the helper method to validate at least one of gRPC gateway route match type is defined. */ export function validateGrpcGatewayRouteMatch(match: GrpcGatewayRouteMatch): void { - if (match.serviceName === undefined && match.metadata === undefined && match.hostname === undefined) { + if (match.serviceName === undefined && match.metadata === undefined && match.hostname === undefined && match.port === undefined) { throw new Error('At least one gRPC gateway route match property beside rewriteRequestHostname must be provided'); } } diff --git a/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts b/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts index da3c9c204912e..e6080c25801e6 100644 --- a/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts @@ -66,6 +66,13 @@ export interface HttpRouteMatch { * @default - do not match on query parameters */ readonly queryParameters?: QueryParameterMatch[]; + + /** + * The port to match from the request. + * + * @default - do not match on port + */ + readonly port?: number; } /** @@ -110,6 +117,13 @@ export interface GrpcRouteMatch { * @default - do not match on method name */ readonly methodName?: string; + + /** + * The port to match from the request. + * + * @default - do not match on port + */ + readonly port?: number; } /** @@ -459,6 +473,7 @@ class HttpRouteSpec extends RouteSpec { method: this.match?.method, scheme: this.match?.protocol, queryParameters: queryParameters?.map(queryParameter => queryParameter.bind(scope).queryParameterMatch), + port: this.match?.port, }, timeout: renderTimeout(this.timeout), retryPolicy: this.retryPolicy ? renderHttpRetryPolicy(this.retryPolicy) : undefined, @@ -551,6 +566,7 @@ class GrpcRouteSpec extends RouteSpec { const serviceName = this.match.serviceName; const methodName = this.match.methodName; const metadata = this.match.metadata; + const port = this.match.port; validateGrpcRouteMatch(this.match); validateGrpcMatchArrayLength(metadata); @@ -569,6 +585,7 @@ class GrpcRouteSpec extends RouteSpec { serviceName: serviceName, methodName: methodName, metadata: metadata?.map(singleMetadata => singleMetadata.bind(scope).headerMatch), + port: port, }, timeout: renderTimeout(this.timeout), retryPolicy: this.retryPolicy ? renderGrpcRetryPolicy(this.retryPolicy) : undefined, diff --git a/packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts index e3de2568705aa..64db612eb1321 100644 --- a/packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts @@ -549,6 +549,77 @@ describe('gateway route', () => { }); }); + describe('with port match', () => { + test('should match based on port', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const mesh = new appmesh.Mesh(stack, 'mesh', { + meshName: 'test-mesh', + }); + + const virtualGateway = new appmesh.VirtualGateway(stack, 'gateway-1', { + listeners: [appmesh.VirtualGatewayListener.http()], + mesh: mesh, + }); + + const virtualService = new appmesh.VirtualService(stack, 'vs-1', { + virtualServiceProvider: appmesh.VirtualServiceProvider.none(mesh), + virtualServiceName: 'target.local', + }); + + // Add an HTTP Route + virtualGateway.addGatewayRoute('gateway-http-route', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + match: { + hostname: appmesh.GatewayRouteHostnameMatch.exactly('example.com'), + }, + }), + gatewayRouteName: 'gateway-http-route', + }); + + virtualGateway.addGatewayRoute('gateway-grpc-route', { + routeSpec: appmesh.GatewayRouteSpec.grpc({ + routeTarget: virtualService, + match: { + port: 1234, + }, + }), + gatewayRouteName: 'gateway-grpc-route', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', { + GatewayRouteName: 'gateway-http-route', + Spec: { + HttpRoute: { + Match: { + Hostname: { + Exact: 'example.com', + }, + }, + Action: { + Rewrite: Match.absent(), + }, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::GatewayRoute', { + GatewayRouteName: 'gateway-grpc-route', + Spec: { + GrpcRoute: { + Match: { + Port: 1234, + }, + }, + }, + }); + }); + }); + describe('with metadata match', () => { test('should match based on metadata', () => { // GIVEN diff --git a/packages/aws-cdk-lib/aws-appmesh/test/route.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/route.test.ts index 95e7f1f285634..4bc11ff32bd15 100644 --- a/packages/aws-cdk-lib/aws-appmesh/test/route.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/route.test.ts @@ -463,6 +463,76 @@ describe('route', () => { }); }); + test('should have grpc route matcher with port when specified', () => { + // GIVEN + const stack = new cdk.Stack(); + const mesh = new appmesh.Mesh(stack, 'mesh', { + meshName: 'test-mesh', + }); + const router = new appmesh.VirtualRouter(stack, 'router', { + mesh, + }); + const virtualNode = mesh.addVirtualNode('test-node', { + serviceDiscovery: appmesh.ServiceDiscovery.dns('test'), + listeners: [appmesh.VirtualNodeListener.grpc()], + }); + + // WHEN + router.addRoute('test-grpc-route', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [{ virtualNode }], + match: { port: 1234 }, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::Route', { + Spec: { + GrpcRoute: { + Match: { + Port: 1234, + }, + }, + }, + RouteName: 'test-grpc-route', + }); + }); + + test('should have http route matcher with port when specified', () => { + // GIVEN + const stack = new cdk.Stack(); + const mesh = new appmesh.Mesh(stack, 'mesh', { + meshName: 'test-mesh', + }); + const router = new appmesh.VirtualRouter(stack, 'router', { + mesh, + }); + const virtualNode = mesh.addVirtualNode('test-node', { + serviceDiscovery: appmesh.ServiceDiscovery.dns('test'), + listeners: [appmesh.VirtualNodeListener.http()], + }); + + // WHEN + router.addRoute('test-http-route', { + routeSpec: appmesh.RouteSpec.http({ + weightedTargets: [{ virtualNode }], + match: { port: 1234 }, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AppMesh::Route', { + Spec: { + HttpRoute: { + Match: { + Port: 1234, + }, + }, + }, + RouteName: 'test-http-route', + }); + }); + test('grpc retry events are Match.absent() when specified as an empty array', () => { // GIVEN const stack = new cdk.Stack();