[dms] Cfn lowercases the replicationSubnetGroupIdentifier on creation but CDK passes the same string without lowercasing.
See original GitHub issueWhile using Cfn level constructs to generate a DMS solution, we had an issue with the replicationSubnetGroupIdentifier
being implicitly lower-cased by CloudFormation but then when we referenced it elsewhere, CDK did not also lower-case the value.
Reproduction Steps
Set your stackName to something with mixed case.
this.subnetGroup = new dms.CfnReplicationSubnetGroup(this, 'DmsSubnetGroup', {
// If you might be mixing cases, you're going to want to force this to lowercase...
replicationSubnetGroupIdentifier: `${scope.stackName}-subnet-group`,
replicationSubnetGroupDescription: `${scope.stackName} Subnet Group`,
subnetIds: scope.vpc.privateSubnets.map((s): string => {
return s.subnetId;
}),
});
new cdk.CfnOutput(this, 'TheDmsSubnetGroupArn', { value: this.subnetGroup.ref });
this.instance = new dms.CfnReplicationInstance(this, 'Instance', {
replicationInstanceIdentifier: `${scope.stackName}-lims-instance`,
replicationInstanceClass: 'dms.t2.micro', // WRITEME: do we need this configurable?
kmsKeyId: this.kmsKey.keyId,
// Cfn will .toLowerCase this, and CDK won't do that for you.
replicationSubnetGroupIdentifier: this.subnetGroup.replicationSubnetGroupIdentifier,
vpcSecurityGroupIds: [sg.securityGroupId],
publiclyAccessible: false,
});
this.instance.addDependsOn(this.subnetGroup);
What did you expect to happen?
I expected replicationSubnetGroupIdentifier: this.subnetGroup.replicationSubnetGroupIdentifier
to provide a working reference.
What actually happened?
The SubnetGroup resource is created with all lower-case names. The Instance resource is passed a replicationSubnetGroupIdentifier with mixed case. The Instance resource then fails to create.
Environment
- CDK CLI Version : 1.66.0
- Framework Version: 1.66.0
- Node.js Version: v14.3.0
- OS: Darwin andrew-hammond-C02XKGFMJG5H-SM 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
- Language (Version): TypeScript (4.0.3)
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (9 by maintainers)
Top Results From Across the Web
A VPC associated with the ReplicationSubnetGroup does not ...
... Cfn lowercases the ReplicationSubnetGroupIdentifier (dms-subnetgroupdemo) on creation as shown below but CDK passes the same string ...
Read more >class CfnReplicationInstance (construct) · AWS CDK
This parameter is stored as a lowercase string. replicationSubnetGroupIdentifier? string, A subnet group to associate with the replication instance.
Read more >A VPC associated with the ReplicationSubnetGroup does not exist ...
... Cfn lowercases the ReplicationSubnetGroupIdentifier (dms-subnetgroupdemo) on creation as shown below but CDK passes the same string without lowercasing.
Read more >Creating an AWS DMS task using AWS CDK - Stack Overflow
There are no CDK constructs to simplify working with DMS. Therefore you'll have to use the CloudFormation resources: CfnEndpoint, ...
Read more >awsdms - Go Packages
import dms "github.com/aws/aws-cdk-go/awscdk" ... Construct, id *string, . ... If you pass CDK classes or structs, they will be // rendered with lowercased...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What you could do is use the subnetGroup Ref:
The
Ref
is a value resolved by CloudFormation at deploy time, from DMS docs:Using
Ref
will also implicitly create the dependency between the subnetGroup and the instance, so you remove the line that adds it explicitly:⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.