Cluster deployment files let you reuse your infrastructure blueprints across environments by overriding parameters instead of duplicating code. This document describes the configuration precedence and structure of cluster deployment files.
About cluster deployment files
Cluster blueprints define infrastructural patterns that you can deploy repeatedly for different workloads or environments. Deployment files act as an overlay mechanism that modifies a blueprint's configuration without altering the underlying Terraform and Packer modules.
Using deployment files can help you do the following:
- Ensure unique names for each individual deployment.
- Specify target environments, such as changing the
project_id,region, orzone. - Override backend configuration defaults for Terraform state management.
Supported configuration parameters
You can specify variables and default backend settings in the deployment file by using a YAML structure.
The following example shows the parameters that can be configured in a deployment file:
vars:
project_id: PROJECT_ID
deployment_name: DEPLOYMENT_NAME
region: REGION
zone: ZONE
terraform_backend_defaults:
type: gcs
configuration:
bucket: BUCKET_NAME
Replace the following:
PROJECT_ID: The unique identifier for your target Google Cloud project.DEPLOYMENT_NAME: A custom name for your cluster deployment.REGION: The Google Cloud region where you want to deploy your cluster resources.ZONE: The specific Google Cloud zone within the region for your deployment.BUCKET_NAME: The name of the Cloud Storage bucket used to store your remote Terraform state.
Variable precedence rules
When variables are defined in multiple locations, Cluster Toolkit resolves conflicts using a strict order of precedence.
The following precedence rules apply from highest priority to lowest priority:
- Command-line flags: Values supplied using the
--varsflag of thegcluster createorgcluster deploycommands have the highest precedence. - Deployment files: If a variable is specified in the deployment file, then it takes precedence over the blueprint definition.
- Blueprint defaults: Any variable not supplied by a command-line flag or a deployment file defaults to the value defined in the cluster blueprint.
If terraform_backend_defaults is set in a deployment file, then it replaces
all backend default settings declared in the blueprint.
What's next
- Learn how to deploy clusters in the Deploy a cluster with blueprints.
- Review the Module overview to understand how modules extend blueprints.