So, in my idea for a stack, I have a need to create all resources with a certain name, and that will be formed based on the parameters while creating a stack, like this:
Param1: blue
Param2: car
So, all the resources will be named blue-car, and I will need to cross-reference between them in the template. So for instance, there will be a bucket called 'blue-car' and I will be creating Policies and Roles for this bucket.
Can I, in some way, define a custom global variable (or something else with the same effect) that I would be able to reference everytime I need this NAME, or would I have to keep using ugly !Joins all the time?
So instead of doing this:
Resource:
- !Join
- 'arn:aws:s3:::'
- - !FindInMap
- Naming
- BasicPrefix
- Name
- '-'
- !Ref BusinessUnitName
- !Ref EnvType
- !Join
- 'arn:aws:s3:::'
- - !FindInMap
- Naming
- BasicPrefix
- Name
- '-'
- !Ref BusinessUnitName
- !Ref EnvType
- '/*'
I could do this instead:
Resource:
- !Join
- 'arn:aws:s3:::'
- {$SomethingMoreHandy}
- !Join
- 'arn:aws:s3:::'
- {$SomethingMoreHandy}
- '/*'