Fn::Template for variable substitution
A function Fn::Template which allows heat environment values to be inserted into string blocks like UserData scripts using a template substitution format.
There are many templating engines to choose from - probably simpler is better in this situation. One option is python Template Strings:
http://
Having to escape $ with $$ shouldn't be too difficult for users.
"/tmp/
"content" : { "Fn::Template" : { "Fn::Join" : ["\n", [
"CREATE DATABASE $DBName",
"GRANT ALL PRIVILEGES ON ${DBName}.* TO ${DBUsername}
"IDENTIFIED BY '${DBPassword};",
"FLUSH PRIVILEGES;",
"EXIT"]]}}
},
For YAML this would make it possible to build strings without Fn::Join, eg
/tmp/setup.mysql
content
Fn::Template: |-
CREATE DATABASE $DBName
GRANT ALL PRIVILEGES ON ${DBName}.* TO ${DBUsername}
IDENTIFIED BY '${DBPassword};
FLUSH PRIVILEGES;
EXIT
This is related to https:/
Also, this is similar to the Fn::Replace suggestion in that blueprint but without the requirement to explicitly declare substitutions:
"/tmp/
"content" : { "Fn::Replace" : {"$DBName$", { "Ref" : "DBName"},
"CREATE DATABASE $DBName$",
"GRANT ALL PRIVILEGES ON $DBName$.* TO $DBUsername$
"IDENTIFIED BY '$DBPassword$;",
"FLUSH PRIVILEGES;",
"EXIT"]]}}
},
Blueprint information
- Status:
- Complete
- Approver:
- Steve Baker
- Priority:
- Medium
- Drafter:
- Steve Baker
- Direction:
- Approved
- Assignee:
- Steve Baker
- Definition:
- Approved
- Series goal:
- Accepted for havana
- Implementation:
- Implemented
- Milestone target:
- 2013.2
- Started by
- Steve Baker
- Completed by
- Steve Baker
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Add Fn::Variables template function.
Addressed by: https:/
Return empty string when Fn::Select target is None.