aws-solutions / workload-discovery-on-aws

Workload Discovery on AWS is a solution to visualize AWS Cloud workloads. With it you can build, customize, and share architecture diagrams of your workloads based on live data from AWS. The solution maintains an inventory of the AWS resources across your accounts and regions, mapping their relationships and displaying them in the user interface.
https://aws.amazon.com/solutions/implementations/workload-discovery-on-aws/
Apache License 2.0
727 stars 88 forks source link

Disclaimer about max. character length that you can define as a CloudFormation stack name #462

Closed lhenriks closed 1 year ago

lhenriks commented 1 year ago

Feature name Max. character limit for CloudFormation stack name.

Is your feature request related to a problem? Please describe. Example CloudFront origin access controls setting has a character limit of 64 characters. Now when you define e.g. "aws-workload-discovery-service" as your stack name it will exceed that 64 characters as it includes (appends) also the ${AWS::StackName} into your resource names. End result would be total of 68 characters e.g. "aws-workload-discovery-service-WebUiStack-1HWNXXXXW4UVX-WD-WebUI-OAC" and it will fail to deploy the section "CloudFrontOac".

Resource handler returned message: "Invalid request provided: AWS::CloudFront::OriginAccessControl" (RequestToken: <uuid>, HandlerErrorCode: InvalidRequest)

Describe the feature you'd like to see implemented Disclaimer into documentation that you should NOT use more than 26 characters for the CF stack name.

svozza commented 1 year ago

I think the best fix here is to not use the stackname at all when naming the OAC resource. There are a few ways in CloudFormation to generate unique identifiers, e.g., we could split the arn of the stack by the / chracter and use the unique stack identifier, like so:

!Select [2, !Split ['/', !Ref "AWS::StackId"]]
lhenriks commented 1 year ago

@svozza Yes of course that would be a better option.

svozza commented 1 year ago

We will be releasing a patch version (v2.1.1) in the near future and I will ensure this fix is included.

svozza commented 1 year ago

This has been fixed in v2.1.2, which was released on Tuesday.