Skip to content
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

Do not merge: test CI #29990

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 21 additions & 2 deletions packages/@aws-cdk/aws-redshift-alpha/lib/cluster.ts
Expand Up @@ -385,6 +385,13 @@ export interface ClusterProps {
* @default - false
*/
readonly enhancedVpcRouting?: boolean;

/**
* Indicating whether Amazon Redshift should deploy the cluster in two Availability Zones.
*
* @default false
*/
readonly multiAz?: boolean;
}

/**
Expand Down Expand Up @@ -558,6 +565,17 @@ export class Cluster extends ClusterBase {
);
}

const nodeType = props.nodeType || NodeType.DC2_LARGE;

if (props.multiAz) {
if (!nodeType.startsWith('ra3')) {
throw new Error('Multi-AZ cluster is only supported for RA3 node types.');
}
if (clusterType === ClusterType.SINGLE_NODE) {
throw new Error('Multi-AZ cluster is not supported for single-node clusters.');
}
}

this.cluster = new CfnCluster(this, 'Resource', {
// Basic
allowVersionUpgrade: true,
Expand All @@ -574,7 +592,7 @@ export class Cluster extends ClusterBase {
?? props.masterUser.masterPassword?.unsafeUnwrap()
?? 'default',
preferredMaintenanceWindow: props.preferredMaintenanceWindow,
nodeType: props.nodeType || NodeType.DC2_LARGE,
nodeType,
numberOfNodes: nodeCount,
loggingProperties,
iamRoles: Lazy.list({ produce: () => this.roles.map(role => role.roleArn) }, { omitEmpty: true }),
Expand All @@ -586,6 +604,7 @@ export class Cluster extends ClusterBase {
classic: props.classicResizing,
elasticIp: props.elasticIp,
enhancedVpcRouting: props.enhancedVpcRouting,
multiAz: props.multiAz,
});

this.cluster.applyRemovalPolicy(removalPolicy, {
Expand Down Expand Up @@ -836,4 +855,4 @@ export class Cluster extends ClusterBase {

clusterRoleList.push(role);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.