Skip to main content

Customize Component Behavior

In Atmos, every component is associated with a command. The command is what drives or provisions that component. For example, Terraform "root modules" can be used as components in Atmos. To instruct Atmos how to interact with that component, we must specify the command to run and and where the code for the component is located. Then, depending on the type of component, certain behaviors can be configured.

The components section of the atmos.yaml is how we do it. It defines how Atmos locates and executes your components. Think of it as the bootstrapping configuration. This is where we can define the the command to run, the base_path location of the components, and so forth.

important

Do not confuse this configuration with configuring components in stacks. This configuration below is defined in the atmos.yaml and meant for specifying default behaviors for components, such as what command to use when running Terraform commands, the base path for Terraform, and more.

Terraform Component Behaviorโ€‹

For additional details on configuring Terraform components, refer to the Terraform and OpenTofu documentation.

Disambiguation

The term โ€œTerraformโ€ is used in this documentation to refer to generic concepts such as providers, modules, stacks, the HCL-based domain-specific language and its interpreter. Atmos works with OpenTofu.

atmos.yaml

components:
terraform:
# Optional `command` specifies the executable to be called by Atmos when running Terraform commands
# If not defined, `terraform` is used
# Examples:
# command: terraform
# command: /usr/local/bin/terraform
# command: /usr/local/bin/terraform-1.8
# command: tofu
# command: /usr/local/bin/tofu-1.7.1
# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_COMMAND' ENV var, or '--terraform-command' command-line argument
command: terraform

# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_BASE_PATH' ENV var, or '--terraform-dir' command-line argument
# Supports both absolute and relative paths
base_path: "components/terraform"

# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_APPLY_AUTO_APPROVE' ENV var
apply_auto_approve: false

# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT' ENV var, or '--deploy-run-init' command-line argument
deploy_run_init: true

# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_INIT_RUN_RECONFIGURE' ENV var, or '--init-run-reconfigure' command-line argument
init_run_reconfigure: true

# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_AUTO_GENERATE_BACKEND_FILE' ENV var, or '--auto-generate-backend-file' command-line argument
auto_generate_backend_file: true

init:
# Can also be set using 'ATMOS_COMPONENTS_TERRAFORM_INIT_PASS_VARS' ENV var, or '--init-pass-vars' command-line argument
pass_vars: false
command

Specifies the executable to be called by atmos when running Terraform/OpenTofu commands. If not defined, terraform is used. Can also be set using ATMOS_COMPONENTS_TERRAFORM_COMMAND ENV var, or --terraform-command command-line argument.

Example values: terraform, /usr/local/bin/terraform, tofu, /usr/local/bin/tofu-1.7.1.

base_path

Base path to the Terraform/OpenTofu components.

Example value: "components/terraform". Can also be set using ATMOS_COMPONENTS_TERRAFORM_BASE_PATH ENV var, or --terraform-dir command-line argument. Supports both absolute and relative paths.

apply_auto_approve

If set to true, Atmos automatically adds the -auto-approve option to instruct Terraform to apply the plan without asking for confirmation when executing terraform apply command

deploy_run_init

If set to true, Atmos runs terraform init before executing atmos terraform deploy command

init_run_reconfigure

If set to true, Atmos automatically adds the -reconfigure option to update the backend configuration when executing terraform init command

auto_generate_backend_file

If set to true, Atmos automatically generates the Terraform backend file from the component configuration when executing terraform plan and terraform apply commands

init.pass_vars

If set to true, Atmos automatically passes the generated varfile to the tofu init command using the --var-file flag. OpenTofu supports passing a varfile to init to dynamically configure backends

Helmfile Component Behaviorโ€‹

atmos.yaml

components:
helmfile:
# Optional `command` specifies the executable to be called by Atmos when running Helmfile commands
# If not defined, `helmfile` is used
# Examples:
# command: helmfile
# command: /usr/local/bin/helmfile
# Can also be set using 'ATMOS_COMPONENTS_HELMFILE_COMMAND' ENV var, or '--helmfile-command' command-line argument
command: helmfile

# Can also be set using 'ATMOS_COMPONENTS_HELMFILE_BASE_PATH' ENV var, or '--helmfile-dir' command-line argument
# Supports both absolute and relative paths
base_path: "components/helmfile"

# Can also be set using 'ATMOS_COMPONENTS_HELMFILE_USE_EKS' ENV var
# If not specified, defaults to 'true'
use_eks: true

# Can also be set using 'ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH' ENV var
kubeconfig_path: "/dev/shm"

# Can also be set using 'ATMOS_COMPONENTS_HELMFILE_HELM_AWS_PROFILE_PATTERN' ENV var
helm_aws_profile_pattern: "{namespace}-{tenant}-gbl-{stage}-helm"

# Can also be set using 'ATMOS_COMPONENTS_HELMFILE_CLUSTER_NAME_PATTERN' ENV var
cluster_name_pattern: "{namespace}-{tenant}-{environment}-{stage}-eks-cluster"
command

Specifies the executable to be called by atmos when running Helmfile commands. If not defined, helmfile is used. Can also be set using ATMOS_COMPONENTS_HELMFILE_COMMAND ENV var, or --helmfile-command command-line argument.

Example values: helmfile, /usr/local/bin/helmfile.

base_path

Base path to the Helmfile components.

Example value: "components/helmfile". Can also be set using ATMOS_COMPONENTS_HELMFILE_BASE_PATH ENV var, or --helmfile-dir command-line argument. Supports both absolute and relative paths.

use_eks

If not specified, defaults to true. Can also be set using ATMOS_COMPONENTS_HELMFILE_USE_EKS ENV var.

kubeconfig_path

Can also be set using ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH ENV var. Example value: /dev/shm.

helm_aws_profile_pattern

Can also be set using ATMOS_COMPONENTS_HELMFILE_HELM_AWS_PROFILE_PATTERN ENV var. Example value:

{namespace}-{tenant}-{gbl}-{stage}-helm
cluster_name_pattern

Can also be set using ATMOS_COMPONENTS_HELMFILE_CLUSTER_NAME_PATTERN` ENV var. Example value:

{namespace}-{tenant}-{environment}-{stage}-eks-cluster`