Config files allow you to define a BYOC application using a single .toml file. Under the hood, Nuon will handle keeping your configuration in sync.

Create an app

Create a local App directory - Create a directory and name it after your App. This directory will contain your App’s configuration files.

mkdir your-app
cd your-app

Config files are used to sync the configuration for a single App. To create an App with no configuration files. e.g., so you can sync existing config files later. For consistency, use the same name as the directory you created above.

nuon apps create  \
  --name=your-app --no-template

If you happened to create the App without --no-template and a your-app.toml was created, delete the file and create you own config files.

Sync an App

To sync an app, and it’s configuration run:

nuon
nuon apps sync

Breaking up Config Files

As your config grows, keeping everything in a single file can become unmanagable. Create components and actions directories in your project root and individual files for each component. e.g., helm_deploy.toml.

helm_deploy.toml
#:schema https://api.nuon.co/v1/general/config-schema?source=helm
name           = "whoami"
type           = "helm_chart"
chart_name     = "whoami"
namespace      = "whoami"
storage_driver = "configmap"

[public_repo]
repo      = "nuonco/demo"
directory = "eks-simple/src/components/whoami"
branch    = "main"

[[values_file]]
contents = "./whoami.yaml"

When loading a component from a source, the components prefix is not needed for each field, like it is in the main config file.

Reference

Input Config

Define inputs for an app using inputs.toml file.

To configure a sensitive api_key and vpc_id input:

inputs.toml
#:schema https://api.nuon.co/v1/general/config-schema?source=inputs
[inputs]
name = "vpc_id"
description = "vpc_id to install application into"
default = ""
sensitive = false
display_name = "VPC ID"
type = "string"

[[inputs]]
name = "api_key"
description = "API key"
default = ""
sensitive = true
display_name = "API Key"
type = "string"

Inputs are not required, unless you are using a Sandbox that requires Inputs. e.g., root_domain for the aws-eks-sandbox.

Sandbox Config

Define the sandbox for an app using a [sandbox] block.

To define an aws-eks-sandbox Sandbox:

sandbox.toml
#:schema https://api.nuon.co/v1/general/config-schema?source=sandbox
terraform_version = "1.11.3"

[public_repo]
directory = "."
repo      = "nuonco/aws-eks-sandbox"
branch    = "main"

[vars]
cluster_name         = "n-{{.nuon.install.id}}"
enable_nuon_dns      = "true"
public_root_domain   = "{{ .nuon.inputs.inputs.root_domain }}"
internal_root_domain = "internal.{{ .nuon.inputs.inputs.root_domain }}"

[[var_file]]
contents = "./sandbox.tfvars"

Notice how variables can be defined in the vars block and with var_file.

Component Config

You can define components by creating <component>.toml files in a components directory. Components must declare a type field and any relevant component-specific configuration.

Each component will have dependencies automatically defined based on the order in the config file. Learn more about depencencies here.

Terraform Module Component

To define a terraform module component use the terraform_module type.

To configure a terraform component using a connected repo:

my-tf-component.toml
#:schema https://api.nuon.co/v1/general/config-schema?source=terraform
name = "terraform"
type = "terraform_module"
terraform_version = "1.11.3"

[connected_repo]
directory = "infra"
repo = "org/repo"
branch = "main"

[env_vars]
AWS_REGION = "{{.nuon.install.sandbox.account.region}}"

[vars]
account_id = "{{.nuon.install.sandbox.account.id}}"

Helm Chart Component

To define a helm chart component use the helm_chart type.

To configure a helm chart in a connected repo:

helm.toml
#:schema https://api.nuon.co/v1/general/config-schema?source=helm
name = "helm"
type = "helm_chart"
chart_name = "chart-name"

[components.connected_repo]
directory = "helm"
repo = "org/repo"
branch = "main"

[values]
"api.ingresses.public_domain" = "{{.nuon.install.sandbox.outputs.nuon_dns.public_domain.name}}"

Docker Build Component

To define a docker build component use the docker_build type.

To configure a docker build component from a private repo:

docker_build.toml
name = "docker_build"
type = "docker_build"

dockerfile = "Dockerfile"

[connected_repo]
directory = "deployment"
repo = "powertoolsdev/mono"
branch = "main"

Container Image Component

To define a container image component use the container_image type.

To configure a public container image:

container_image.toml
name = "container_image"
type = "container_image"

[public]
image_url = "kennethreitz/httpbin"
tag = "latest"

To configure a container image from an ECR repo:

container_image_ecr.toml
name = "container_image_ecr"
type = "container_image"

[aws_ecr]
iam_role_arn = "iam_role_arn"
image_url = "ecr-url"
tag = "latest"
region = "us-west-2"