-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws_Route53: (HostedZone.add_vpc set incorrect region) #20496
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-route53Related to Amazon Route 53Related to Amazon Route 53bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdRelated to contributions. See CONTRIBUTING.mdp1
Description
Describe the bug
route53.HostZone.add_vpc sets regions for the stack's regions, not the VPC's region.
Expected Behavior
The regions for the VPCs should be correct.
"PrivateDnsE0FF4F9B": {
"Type": "AWS::Route53::HostedZone",
"Properties": {
"Name": "slurmiad.local.",
"VPCs": [
{
"VPCId": "vpc-nnnnnnnnnnnnnnnnn",
"VPCRegion": "us-east-1"
},
{
"VPCId": "vpc-nnnnnnnnnnnnnnnnn",
"VPCRegion": "us-west-2"
},
{
"VPCId": "vpc-nnnnnnnnnnnnnnnnn",
"VPCRegion": "eu-west-1"
}
]
},
"Metadata": {
"aws:cdk:path": "slurmiad/PrivateDns/Resource"
}
},
Current Behavior
The resulting CFN template has the correct VpcIds, but the incorrect regions:
"PrivateDnsE0FF4F9B": {
"Type": "AWS::Route53::HostedZone",
"Properties": {
"Name": "slurmiad.local.",
"VPCs": [
{
"VPCId": "vpc-nnnnnnnnnnnnnnnnn",
"VPCRegion": "us-east-1"
},
{
"VPCId": "vpc-nnnnnnnnnnnnnnnnn",
"VPCRegion": "us-east-1"
},
{
"VPCId": "vpc-nnnnnnnnnnnnnnnnn",
"VPCRegion": "us-east-1"
}
]
},
"Metadata": {
"aws:cdk:path": "slurmiad/PrivateDns/Resource"
}
},
Reproduction Steps
I'm creating a Route53.HostedZone for use in 3 VPCs that are located in 3 different regions.
The VPCs aren't part of the stack and are created in CDK using
ec2.Vpc.from_lookup(
self, f"Vpc{region_dict['Region']}",
region = region_dict['Region'],
vpc_id = region_dict['VpcId'])
This causes an update to cdk.context.json where the VPC ids and regions are correct.
Extract from cdk.context.json:
"vpc-provider:account=nnnnnnnnnnnn:filter.vpc-id=vpc-nnnnnnnnnnnnnnnnn:region=us-west-2:returnAsymmetricSubnets=true": {
"vpcId": "vpc-nnnnnnnnnnnnnnnnn",
"vpcCidrBlock": "10.3.0.0/16",
"availabilityZones": [],
"subnetGroups": [
{
"name": "Private",
"type": "Private",
"subnets": [
{
"subnetId": "subnet-nnnnnnnnnnnnnnnnn",
"cidr": "10.3.64.0/18",
"availabilityZone": "us-west-2a",
"routeTableId": "rtb-nnnnnnnnnnnnnnnnn"
},
{
"subnetId": "subnet-nnnnnnnnnnnnnnnnn",
"cidr": "10.3.128.0/18",
"availabilityZone": "us-west-2b",
"routeTableId": "rtb-nnnnnnnnnnnnnnnnn"
},
{
"subnetId": "subnet-nnnnnnnnnnnnnnnnn",
"cidr": "10.3.192.0/18",
"availabilityZone": "us-west-2c",
"routeTableId": "rtb-nnnnnnnnnnnnnnnnn"
}
]
},
{
"name": "Public",
"type": "Public",
"subnets": [
{
"subnetId": "subnet-nnnnnnnnnnnnnnnnn",
"cidr": "10.3.0.0/26",
"availabilityZone": "us-west-2a",
"routeTableId": "rtb-nnnnnnnnnnnnnnnnn"
},
{
"subnetId": "subnet-nnnnnnnnnnnnnnnnn",
"cidr": "10.3.0.64/26",
"availabilityZone": "us-west-2b",
"routeTableId": "rtb-nnnnnnnnnnnnnnnnn"
},
{
"subnetId": "subnet-nnnnnnnnnnnnnnnnn",
"cidr": "10.3.0.128/26",
"availabilityZone": "us-west-2c",
"routeTableId": "rtb-nnnnnnnnnnnnnnnnn"
}
]
}
]
},
I create the Hosted Zone:
self.hosted_zone = route53.HostedZone(self, "PrivateDns",
vpcs = [self.vpc],
zone_name = self.config['Domain']
)
self.hosted_zone.add_vpc(remote_vpcs[region_dict['Region']])
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.25.0
Framework Version
No response
Node.js Version
16.15.0
OS
AmazonLinux2
Language
Python
Language Version
Python 3.7.10
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-route53Related to Amazon Route 53Related to Amazon Route 53bugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdRelated to contributions. See CONTRIBUTING.mdp1