Closed ScottChapman closed 6 years ago
We would likely need this for implementing a IBM Cloud Functions Template for Watson Workspace.
Watson Workspace is a Slack-like app IBM sells and we have lots of internal and external paying customers that are looking for solutions for developing and deploying their apps.
This mechanism is needed to support that effort.
@ScottChapman this would be a new feature we would to design... to capture some thoughts...
we could take the approach that JSON is a first-class format/citizen in the Serverless space and work to get interpolation done quickly, but should make it an option it might not be good to assume it is a default behavior perhaps the app developer wants the $() encoding left alone for their own use (edited) and it may not be granular at the document / manifest level either may need to add a keyword to the data type like “interpolate” which gives us permission to change the actual JSON data (or other data formats going forward) thoughts?
I think that seems reasonable. Make it so.
Looking at k8s and helm, templating is based on go templates ({{ .username }}
). Maybe we could have the same for wskdeploy?
I think the issue isn't what syntax is used for injecting env vars, the issue is that right now the text associated with a JSON object is taken as a literal and not interpreted.
SO interpreting the text would be a new feature, and would need to preserve existing behavior.
(I suspect)
Any target for this? I am getting close to having a template ready for deployment, and need to be able to specify some variables for it.
I think we should clearly get an indicator from the user/author to permit us to alter the value of an input parameter.
inputs:
type: json
interpolate: true # default false
MyKey: {
username: ${username},
password: ${password}
}
Lionel suggests an in-line indicator (e.g., '\' backslash or a second '$'); look to Terraform perhaps for an example of what they are doing.
Terraform is using $$
to escape interpolation: https://www.terraform.io/docs/configuration/interpolation.html
Go template (used by kubernetes) does not provide a way to escape interpolation because the delimiter literal can be the interpolation result ({{"{{"}}
)
I tried the following without success: