Fixed Failures in CloudFormation Provisioning of S3 Buckets When Stack has Long Name... (#3169)
* Fixed defect with CloudFormation provisioning of S3 buckets occuring when stack has a long name, resulting in the default S3 bucket name's length exceeding its 63 char limit. * PR 3169 July 23, 2020 2:57a ET comment: added additional asserts to assure provisioned bucket's name complies. Fixed bug in my earlier change that could produce default bucket names with illegal upper-case characters in it. Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
This commit is contained in:
parent
ff1f565142
commit
736c8b77ce
2 changed files with 31 additions and 0 deletions
|
|
@ -317,6 +317,12 @@ def generate_resource_name(resource_type, stack_name, logical_id):
|
|||
if truncated_name_prefix.endswith("-"):
|
||||
truncated_name_prefix = truncated_name_prefix[:-1]
|
||||
return "{0}-{1}".format(truncated_name_prefix, my_random_suffix)
|
||||
elif resource_type == "AWS::S3::Bucket":
|
||||
right_hand_part_of_name = "-{0}-{1}".format(logical_id, random_suffix())
|
||||
max_stack_name_portion_len = 63 - len(right_hand_part_of_name)
|
||||
return "{0}{1}".format(
|
||||
stack_name[:max_stack_name_portion_len], right_hand_part_of_name
|
||||
).lower()
|
||||
else:
|
||||
return "{0}-{1}-{2}".format(stack_name, logical_id, random_suffix())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue