aws / aws/aws-cdk

opensearchservice: unable to create IDomain from Token

Open
#24,005 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-opensearch bug effort/small p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

opensearchservice.Domain.fromDomainEndpoint unable to us parameters to resolve domain and create IDomain

example:

```
const osDomain = openSearch.Domain.fromDomainEndpoint(
this,
'osDomain',
ssm.StringParameter.valueForStringParameter(this, '/path/to/my/param'),
);
```

https://github.com/aws/aws-cdk/blob/74318c7d22bfc00de9e005f68a0a6aaa58c7db39/packages/%40aws-cdk/aws-opensearchservice/lib/domain.ts#L1730
Creates the url using url.URL, which is a great way to verify its valid, but since the input is a token until deploy it won't resolve

### Expected Behavior

I would expect it to create an IDomain using the Token

### Current Behavior

only works if input is a valid url at synth time

### Reproduction Steps

Create a parameter store parameter at /path/to/my/param containing the OS Domain endpoint url
```
openSearch.Domain.fromDomainEndpoint(
this,
'osDomain',
ssm.StringParameter.valueForStringParameter(this, '/path/to/my/param'),
);
```

### Possible Solution

don't use url.URL

### Additional Information/Context

_No response_

### CDK CLI Version

2.63.1

### Framework Version

_No response_

### Node.js Version

v18.12.1

### OS

macos

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in packages/@aws-cdk/aws-opensearchservice/lib/domain.ts at Domain.fromDomainEndpoint, especially the URL construction around line 1730. Reproduce the issue with an SSM StringParameter token and verify that a domain endpoint supplied as a token can create an IDomain during synthesis; add or update focused tests if the repository has coverage for this entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.