aws / aws/aws-cdk

aws-opensearchservice: Creating a domain fails for vpc/subnets in the pipeline

Open
#25,017 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-opensearch bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

I'm moving CDK app to the pipeline.
For unknown reason the vpc property returns only 2 subnets (in form of unresolved tokens), for Domain construct.
This stack was deployed before, now it is a stage

So when I use this property in OPENSEARCH.Domain, cdk can't compile templates
```
zoneAwareness: {
availabilityZoneCount: 3,
}
```

### Expected Behavior

cdk can compile properly

### Current Behavior

```
cdk synth

Error: When providing vpc options you need to provide a subnet for each AZ you are using
--
at new Domain (/codebuild/output/src177872962/src/node_modules/aws-cdk-lib/aws-opensearchservice/lib/domain.js:1:6514)
at OpenSearchConstruct.createDomain (/codebuild/output/src177872962/src/lib/constructs/openSearchConstruct.ts:26:19)
at new TridentInfraCDK (/codebuild/output/src177872962/src/lib/stacks/index.ts:160:25)
at Object. (/codebuild/output/src177872962/src/bin/app.ts:9:1)
at Module._compile (node:internal/modules/cjs/loader:1165:14)
at Module.m._compile (/codebuild/output/src177872962/src/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
at Object.require.extensions. [as .ts] (/codebuild/output/src177872962/src/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1043:32)
at Function.Module._load (node:internal/modules/cjs/loader:878:12)

```

### Reproduction Steps

Plain vanilla VPC + OPENSEARCH.Domain + CDK Pipelines (sorry can't provide actual example since CDK app structure is pretty custom). However, VPC props is standard

```
{
ipAddresses: EC2.IpAddresses.cidr('10.0.0.0/16'),
natGateways: 1,
maxAzs: 3,
subnetConfiguration: [
{
cidrMask: 24,
name: 'ingress',
subnetType: EC2.SubnetType.PUBLIC,
},
{
cidrMask: 24,
name: 'application',
subnetType: EC2.SubnetType.PRIVATE_WITH_EGRESS,
},
{
cidrMask: 24,
name: 'rds',
subnetType: EC2.SubnetType.PRIVATE_ISOLATED,
},
],
}

```

### Possible Solution

Can't find any

### Additional Information/Context

Tried with latest cdk versions as well.

### CDK CLI Version

2.65

### Framework Version

2.65

### Node.js Version

v16.17.0

### OS

Mac OSX

### Language

Typescript

### Language Version

"typescript": "^4.6.3"

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `cdk synth` with the listed VPC configuration, CDK Pipelines, and an OpenSearch Domain using three availability zones. Read `lib/constructs/openSearchConstruct.ts:26` and the stack entry at `lib/stacks/index.ts:160` alongside the reported aws-opensearchservice validation. Done means the pipeline stack synthesizes successfully with the three-AZ VPC configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.