description: Example nginx package to demonstrate Zarf variables
# Constants are defined on package create and do not change on deploy
# This demonstrates setting the nginx version to bake into the package using a package variable (PKG_TMPL)
# NOTE: package templates (PKG_TMPL) only apply to zarf.yaml files so defining this here turns into ###ZARF_CONST_NGINX_VERSION### on deploy
# ALSO NOTE: the PKG_TMPL is surrounded by quotes ("") inside of the zarf.yaml, while this is not required for deploy-time variables, PKG_TMPLs will be removed as comments without them
value: "###ZARF_PKG_TMPL_NGINX_VERSION###"
pattern: "^[\\w\\-\\.]+$"
# Demonstrates injecting custom variables into a K8s resource
# OPTIONAL_FOOTER injects a configurable footer into the site but has an empty default with no description and will not prompt the user interactively
# STYLE sets the CSS styles for the site with a default and does not prompt the user for them (note the autoIndent key and that it is multi-line)
body { font-family: sans-serif; color: white; background: #0a0e2e; }
pre { color: white; background: black; }
# SITE_NAME sets the name of the site and will ask the user interactively if it is not set on the CLI or in the config file
description: The name of the site you are deploying (i.e. Lula Website)
pattern: "^[\\w\\s\\-\\.]+$"
# ORGANIZATION sets the organization to Defense Unicorns as a default but prompts the user if they would like to override it
description: The organization providing the site
default: Defense Unicorns
pattern: "^[\\w\\s\\-\\.]+$"
# AWS_REGION sets the region to set in the modified-terraform file and sets `sensitive` so that it will not be saved in the log
# MODIFIED_TERRAFORM sets a filepath for a terraform file to be used as the contents of a template
- name: MODIFIED_TERRAFORM
default: modified-terraform.tf
# The following component templates the provided .tf file with the defined AWS_REGION
# NOTE: this component does not actually execute this file in this example
- name: variables-with-terraform
description: Change a value in a regular file with a Zarf variable. Set
AWS_REGION variable to modify the file.
- source: simple-terraform.tf
target: modified-terraform.tf
# This command uses Zarf to return the SHASUM of the terraform file (`type: file` variables will return the filepath instead of the contents when used in actions due to constraints on env var size)
- cmd: ./zarf prepare sha256sum ${ZARF_VAR_MODIFIED_TERRAFORM}
# `mute` is set to exclude the command output from being shown (since we are treating it as sensitive below)
- name: MODIFIED_TERRAFORM_SHASUM
# `sensitive` is set to exclude the command output from the logs
# `pattern` here will ensure that we get a properly formatted sha256 sum back from the zarf prepare command
pattern: "^[\\da-f]{64}$"
# The following component deploys nginx to the cluster using the defined variables
- name: variables-with-nginx
description: "This component deploys nginx version
###ZARF_PKG_TMPL_NGINX_VERSION### to the cluster"
# This sets the nginx image tag to the same PKG_TMPL used for the constant above to keep the zarf.yaml and nginx-deployment.yaml in sync
- "nginx:###ZARF_PKG_TMPL_NGINX_VERSION###"
- name: variables-with-nginx