Add support for app spec "input variables".
C
Chris Ackerman
Problem:
I want to inject a service environment variable into my app spec from a Github secret, _instead_ of using an encrypted environment variable stored in the app spec itself.Proposal:
Add a "vars" section to the app spec for defining input variables, similar to terraform's input variables. Input variables could be passed as command line parameters to the doctl CLI using the --var my-variable=some-value
option. Define values in the app spec using a ${{var.my-variable}}
placeholder, which will be replaced when the app spec is read.I suggest the double curly bracket enclosure to indicate yaml substitutions, as opposed to the single curly bracket enclosure used for build/deploy-time bindable variables. Also, adding the
var.
prefix inside the enclosure leaves room for other sources of substitution in the future.Example:
vars:
- key: my-variable
type: string
default: some-default-value
services:
- name: foo
envs:
- key: MY_RUNTIME_VAR
scope: RUN_TIME
value: ${{var.my-variable}}
Deploy the spec:
doctl app create --spec app.yaml --var my-variable=some-value
Alternative:
Currently I'm using sed
to do a string replacement in the app spec yaml file just before upserting the app using doctl
.