aws / aws/aws-cdk

aws_redshift: parameterGroupName is marked as optional in L1 constructs but cloudformation requires it now

Open
#28,591 3 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/aws-redshift bug effort/medium needs-cfn p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_redshift.CfnClusterParameterGroup.html#parametergroupname-1
The parameterGroupName is listed as optional on the L1 constructs doc page ^

The L2 constructor does not set it (but does have something it tracks called ‘clusterParameterGroupName’):
https://github.com/aws/aws-cdk/blob/v2.118.0/packages/%40aws-cdk/aws-redshift-alpha/lib/parameter-group.ts#L76-L86
It also has not changed in ~ 7 months

| CREATE_FAILED | AWS::Redshift::ClusterParameterGroup | MyParameterGroup...
Resource handler returned message: "1 validation error detected: Value null at 'parameterGroupName' failed to satisfy constraint: Member must not be null (Service: Redshift, Status Code: 400, Request ID: ...

The L2 constructor provides no way to set the parameterGroupName on the L1 construct manually, the L1 construct CfnClusterParameterGroup does not require it, but cloudformation itself does require it.

AFAIK, this behavior has changed semi recently as we have other CDK setting parameter groups which does not have parameterGroupName set in the final cloudformation generated.

### Expected Behavior

Cloudformation should have accepted this if the parameterGroupName was optional as before.

### Current Behavior

We get this error from cloudformation itself:

```
| CREATE_FAILED | AWS::Redshift::ClusterParameterGroup | MyParameterGroup...
Resource handler returned message: "1 validation error detected: Value null at 'parameterGroupName' failed to satisfy constraint: Member must not be null (Service: Redshift, Status Code: 400, Request ID: ...

```

This is different from previous behavior seen with the same CDK creating other clusters.

### Reproduction Steps

```
import * as redshift from '@aws-cdk/aws-redshift-alpha';

const wlm = [
{
rules: [ ],
},
];
const loggingParamGroup = new redshift.ClusterParameterGroup(this, 'MyParameterGroup', {
description: `Parameter Group for Cluster MyCluster`,
parameters: {
enable_user_activity_logging: 'true',
wlm_json_configuration: JSON.stringify(wlm),
},
});
```

### Possible Solution

- Make the L2 construct in aws-redshift-alpha set the parameterGroupName from clusterParameterGroupName (see: [parameter-group.ts](https://github.com/aws/aws-cdk/blob/v2.118.0/packages/%40aws-cdk/aws-redshift-alpha/lib/parameter-group.ts#L79-L85)

OR

- Provide a way for the parameterGroupName to be manually set from the L2 construct onto the L1 construct

OR

- Cloudformation should set the name to something reasonable when the name is not provided instead of requiring

If cloudformation is not updated, then the optional setting on parameterGroupName should be marked as required instead.

### Additional Information/Context

_No response_

### CDK CLI Version

2.117.0

### Framework Version

_No response_

### Node.js Version

v21.5.0

### OS

MacOS

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with packages/@aws-cdk/aws-redshift-alpha/lib/parameter-group.ts, especially the constructor around the linked lines, and compare its output with the aws_redshift CfnClusterParameterGroup L1 definition. Reproduce the generated template and CloudFormation failure using the TypeScript example; done means the required parameterGroupName is handled consistently and the deployment no longer fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, databases
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.