In CloudFormation, whenever I attempt to use MyComponentVersion
for my Name
I always get the following error of:
Resource handler returned message: "The value supplied for parameter 'name' is not valid. name must match pattern ^[-_A-Za-z-0-9][-_A-Za-z0-9 ]{1,126}[-_A-Za-z-0-9]$ (Service: Imagebuilder, Status Code: 400, Request ID: 249299d3-91b5-43f7-b9ed-1bf01e543821)" (RequestToken: ce08ef58-8fb7-8156-fa7c-c607e318e42a, HandlerErrorCode: InvalidRequest)
However, if I replace Name: !Sub 'MyComponent-v${MyComponentVersion}'
with Name: 'SomeText
it’s completely fine. I’ve tried removing the -
and just putting ${MyComponentVersion}
but it still fails. Seems that I cannot use {MyComponentVersion}
as part of my Name
. However i can use it in the data's
name
no problem.
How can I resolve and have Name: !Sub 'MyComponent-v${MyComponentVersion}
be acceptable?
Parameters:
MyComponentVersion:
Type: String
Default: '2.0.0'
Description: Installs component
Resources:
MyComponent:
Type: AWS::ImageBuilder::Component
Properties:
Name: !Sub 'MyComponent-v${MyComponentVersion}'
Data: !Sub |
name: MyComponent-${MyComponentVersion}
I’ve tried:
- Replacing Name:
!Sub 'MyComponent-v${MyComponentVersion}
with just{MyComponentVersion}
- Just using normal text to see if it works and it’s fine
JoePopov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.