-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(sns): default .fifo suffix for FIFO topics #18740
Comments
It looks like CloudFormation has it on their roadmap to fix this so a topic name doesn't need to be input at creation; however, there's not been on update on the issue in over a year: The above proposal -- to autogenerate a name and suffix the '.fifo' if a name is not provided -- sounds reasonable to me. Contributions welcome! |
There is an issue with the code above. If you look at SQS (for example), the names for queues are generated using the stack name as the prefix. In this case though it looks like I modified the code as follows to correct this: private static replaceStackId(scope: Construct, id: string): string {
const stack = cdk.Stack.of(scope);
// Replace the stack ID in the identifier with the stack name
return id.replace(stack.node.id, stack.stackName);
}
private static buildFifoName(scope: Construct, id: string) {
const uniqueId = this.replaceStackId(
scope,
cdk.Names.uniqueId(scope)
);
const suffix = `${id}.fifo`;
// Make sure that the name fits within the CFN's 80 character limit
return `${uniqueId.slice(0, Math.max(0, 80 - suffix.length))}${suffix}`;
} |
…2375) This PR adds logic for automatic generation of FIFO topics. When customers don't pass a `topicName` during creation, the construct now generates an unique name that respects the maximum length allowed by the CloudFormation resource (256) and that ends with the `.fifo` suffix. The previous behavior was to throw an error when the topic was of type FIFO and no name was passed. Fixes ##18740 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
I think this issue could be closed. The PR with the fix has been merged and the new behavior has been released yesterday |
|
Description
#12386 introduced a requirement to add a topic name whenever a FIFO topic is created.
Do you think it's a good idea to generate a default name if it isn't provided by the user? All of the other CDK resources are named consistently using something similar to what
cdk.Names.nodeUniqueId(node)
does, ieMyStack2EC66409Topic.fifo
, which prevents name collisions.Use Case
Remove the need to manually define a topic name.
Proposed Solution
This is my current implementation:
Other information
No response
Acknowledge
The text was updated successfully, but these errors were encountered: