The Components of your App can get custom configuration settings applied by using variables. Each deployed Component instance can make use of a set of name/value variables to handle configuration settings that need to be set differently on each customer’s instance. Nuon brings in a tree of information from the sources detailed below, which can then be accessed by the Component using a templating syntax inspired by Go templates. This variable replacement templating syntax is used by several other infrastructure management tools.
You can set these variables as vars in your Terraform configuration. For example, if you wanted to set values in a Helm chart:
[[components]]
name = "helm_chart"
type = "helm_chart"
chart_name = "<your-app>"
[components.connected_repo]
directory = "components/helm-chart"
repo = "<your-org>/<your-repo>"
branch = "main"
[components.values]
# manually set a variable
"some-var-name" = "some-var-value"
# reference another component
"reference-to-other-component" = "{{.nuon.components.some_other_component.outputs.s3_bucket_name}}"
Example directly-set value would be
Example dynamic variable reference would be
Name | Value |
---|
bucket_name | {{ .nuon.components.storage.bucket_name }} |
Note After changing variables, you must trigger a new build and release of that component before your changes will take affect.
Same Variable Value on Every Install
Settings common to all your installs can be set directly on the component and it will be the same across all installs.
Example: cache_size
with value 4096
.
Unique Variable Value For Each Install
For example, the install id can be passed as a variable to the Sandbox for an EKS cluster name.
[vars]
cluster_name = "n-{{.nuon.install.id}}"
## Variable Data Sources
### Nuon Information
- **Nuon Organization ID** `{{ .nuon.org.id }}`
* Unique identifier for the vendor organization
- **Nuon Application ID** `{{ .nuon.app.id }}`
* Unique identifier for the vendor application
- **Nuon Install ID** `{{ .nuon.install.id }}`
- **Nuon Install Sandbox Type** `{{ .nuon.install.sandbox.type }}`
* Example: `aws-eks`
- **Nuon Install Sandbox Version** `{{ .nuon.install.sandbox.version }}`
* Example: `0.11.1`
### Nuon Install Sandbox Outputs
See the [aws-eks-sandbox](https://github.com/nuonco/aws-eks-sandbox/blob/main/outputs.tf) repository for the most up-to-date list of outputs available from the Sandbox.
### Install Inputs
Any app input can be accessed using variables. For instance, given an app input, `foo`, it can be accessed using:
- `{{ .nuon.install.inputs.foo }}`
### Output from Other Components in an Application
Some component types including terraform components will provide output values that will be required as input variables to other components of the application. These outputs are available grouped under the slug version of the component name.
- Template Syntax: `{{ .nuon.components.<component_name_slug>.outputs.<output_name> }}`
- Example: `{{ .nuon.components.rds_db.outputs.db_url }}`
### Component Image Data from Other Components in an Application
- `{{ .nuon.components.<component_name_slug>.image.tag }}`
- Docker/OCI Image tag used for the component deployment
- `{{ .nuon.components.<component_name_slug>.image.repository }}`
- ECR Repository containing this component's images
- `{{ .nuon.components.<component_name_slug>.image.registry }}`
- ECR Registry containing this component's images