aws-cloudformation / aws-cloudformation-resource-providers-awsutilities-commandrunner

Apache License 2.0
81 stars 21 forks source link

register.sh fails if uuidgen isn't installed #46

Closed lavigne closed 2 years ago

lavigne commented 2 years ago

Because uuidgen is used to name the S3 bucket used for installation, running register.sh fails if uuidgen isn't installed. The error message the user receives is:

Invalid bucket name "": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$" or be an ARN matching the regex "^arn:(aws).*:(s3|s3-object-lambda):[a-z\-0-9]*:[0-9]{12}:accesspoint[/:][a-zA-Z0-9\-.]{1,63}$|^arn:(aws).*:s3-outposts:[a-z\-0-9]+:[0-9]{12}:outpost[/:][a-zA-Z0-9\-]{1,63}[/:]accesspoint[/:][a-zA-Z0-9\-]{1,63}$"

It looks like there used to be a --bucket-name parameter that could be passed in but that parameter is commented out in the script. Perhaps we could add the parameter back as a workaround for when uuidgen isn't available? It might also be nice if the error message could explain to the user a little more clearly why it's failing. Currently the message is fairly confusing because it talks about an invalid bucket name, but the user hasn't provided a bucket name so it's hard to know what corrective action to take without opening up the script.

shantgup commented 2 years ago

Thank you for bringing this to our attention. For now, I will add a note to the README listing out the CLI commands used by the script.

I removed the --bucket-name parameter because often times the bucket name would already be in use and that would fail the script. Also, I wanted to reduce the number of input parameters passed to the script, making it simpler and more automated for users.

However, I can add it back to the script with the next release, and also add catch statements with meaningful error messages if any of the CLI commands aren't available.

For now, I recommend you install uuidgen and proceed with the resource registration.

Thank you again, your feedback is highly appreciated.