Skip to content

(opensearch): missing validation on domainName property #17016

@nom3ad

Description

@nom3ad

What is the problem?

Currently, opensearch.Domain allows any string value to be used as domainName, this could fail CloudFormation deployment

Reproduction Steps

 new opensearch.Domain(stack, 'Domain', {
     version: opensearch.EngineVersion.OPENSEARCH_1_0,
     domainName: "InvalidName"
 });

What did you expect to happen?

CDK should not allow invalid domain name

What actually happened?

CloudFormation deployment failed:

validation error detected: Value 'InvalidName' at 'domainName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-z][a-z0-9\-]+

CDK CLI Version

1.124.0 (build 65761fe)

Framework Version

No response

Node.js Version

v14.17.4

OS

Ubuntu

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-opensearchRelated to the @aws-cdk/aws-opensearchservice packagebugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions