Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jgautheron/d29fb68e535e6efc7acdc72b4e934748 to your computer and use it in GitHub Desktop.
Save jgautheron/d29fb68e535e6efc7acdc72b4e934748 to your computer and use it in GitHub Desktop.
Fn::ImportValue from other stacks
Tags:
- Key: Name
Value:
!Join ['_', [ ec2, "Fn::ImportValue" : {"Fn::Sub":'${BaseStackName}-Environment'}, test2]]
#This will create a name tag with value: ec2_<yourValueFromOtherStack>_test2
##This is untested, i created this from One import via join.yaml to give you an example with one import and one local stack ref
Tags:
- Key: Name
Value:
!Join ['_', [ ec2, "Fn::ImportValue" : {"Fn::Sub":'${BaseStackName}-Value'}, "Fn::Sub":'${ValueFromThisStack}', test2]]
#This will create a name tag with value: ec2_<yourValueFromOtherStack>_<valueFromThisStack>_test2
Tags:
- Key: Name
Value: !Sub
- ec2_${ValueFromBaseStack}_${ValueFromThisStack}_test2
- ValueFromBaseStack:
Fn::ImportValue: !Sub ${BaseStackName}-Value
#This will create a name tag with value: ec2_<yourValueFromOtherStack>_<valueFromThisStack>_test2
@davidjeddy
Copy link

Thank you @jgautheron ! This just relieved me of a 4 hour problem. @aws why is nesting functions are difficult? Uggg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment