-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(aws-elasticsearch): Vpc.fromLookup returns dummy VPC if the L2 elasticsearch.Domain availabilityZoneCount is set to 3 #12078
Comments
@bleish Thanks for reporting this. To workaround this problem for now, you can temporarily remove the |
This issue also presents itself when combining |
Seeing this is still an issue a year later with the OpenSearch construct. Seems like it should be an easy fix. |
Same issue with VPC-12345. But not using elasticsearch .... |
Same issue using OpenSearch Domain, however mine is: |
This is a weird one. Affecting me to, aws-cdk version 2.29.1; aws-cdk-lib version 2.29.1 |
I too have the issue when
|
If I set the count to
Catch22 😞 |
The way to overcome this is to iterate over the private subnets and then use const vpcSubnets: string[] = [];
props.vpc.privateSubnets.forEach((subnet) => {
vpcSubnets.push(subnet.subnetId);
});
const domain = new cdk.aws_opensearchservice.Domain(this, "Domain", {
vpc: props.vpc,
vpcSubnets: [
{
// subnetType: cdk.aws_ec2.SubnetType.PRIVATE_WITH_EGRESS,
// onePerAz: true,
subnetFilters: [cdk.aws_ec2.SubnetFilter.byIds(vpcSubnets)],
},
], |
It looks like this was fixed by this PR: #22654 |
Closing this issue as it seems like things have been fixed. If the problem persists, feel free to open a new issue. |
|
If the L2 elasticsearch.Domain construct is used with vpcOptions and zoneAwareness, and availabilityZoneCount is set to 3, trying to retrieve a VPC via
ec2.Vpc.fromLookup
fails silently and instead uses a "dummy" VPC with an id of "vpc-12345". The actual error thrown is "When providing vpc options you need to provide a subnet for each AZ you are using", but this is due to the dummy VPC only having 2 subnets instead of the required 3. Interestingly, if the availabilityZoneCount is set to 2, the vpc lookup works fine and doesn't get the dummy VPC. The actual VPC I'm using for this contains 4 private subnets (one for each availability zone in our VPC), but the issue occurs even if I limit the vpcOptions.subnets to 3. This occurs if you try to synth, deploy, or use any command that compiles the cloudformation template. If I instead use the L1 elasticsearch.CfnDomain construct with the same properties, thefromLookup
works as expected.Reproduction Steps
What did you expect to happen?
The lookup should find the VPC and populate the cdk.context.json. The synth should successfully show the resource template with the correct subnets and values.
What actually happened?
An error is thrown, "When providing vpc options you need to provide a subnet for each AZ you are using" due to the VPC lookup silently failing and instead giving dummy data.
Environment
Other
There are numerous open bug reports that are similar to this regarding
Vpc.FromLookup
returning dummy data, but none of them fit this exact scenario. For reference, here are a few that might be related:This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: