Skip to main content

atmos terraform generate backends

Use this command to generate Terraform backend configuration files for all Atmos components across all stacks.

atmos terraform generate backends --help

Usage​

Execute the terraform generate backends command like this:

atmos terraform generate backends [options]

This command generates backend config files for all Atmos terraform components in all stacks.

tip

Run atmos terraform generate backends --help to see all the available options

Examples​

atmos terraform generate backends --file-template {component-path}/{tenant}/{environment}-{stage}.tf.json --format json
atmos terraform generate backends --file-template {component-path}/backends/{tenant}-{environment}-{stage}.tf.json --format json
atmos terraform generate backends --file-template backends/{tenant}/{environment}/{region}/{component}.tf --format hcl
atmos terraform generate backends --file-template backends/{tenant}-{environment}-{stage}-{component}.tf
atmos terraform generate backends --file-template /{tenant}/{stage}/{region}/{component}.tf
atmos terraform generate backends --file-template backends/{tenant}-{environment}-{stage}-{component}.tfbackend --format backend-config
atmos terraform generate backends --stacks orgs/cp/tenant1/staging/us-east-2,orgs/cp/tenant2/dev/us-east-2 --file-template <file_template>
atmos terraform generate backends --stacks tenant1-ue2-staging,tenant1-ue2-prod --file-template <file_template>
atmos terraform generate backends --stacks orgs/cp/tenant1/staging/us-east-2,tenant1-ue2-prod --file-template <file_template>
atmos terraform generate backends --components <component1>,<component2> --file-template <file_template>
atmos terraform generate backends --format hcl --file-template <file_template>
atmos terraform generate backends --format json --file-template <file_template>
atmos terraform generate backends --format backend-config --file-template <file_template>

Flags​

--file-template (optional)

Backend file template (path, file name, and file extension). Supports absolute and relative paths. Supports context tokens: {namespace}, {tenant}, {environment}, {region}, {stage}, {base-component}, {component}, {component-path}. All subdirectories in the path will be created automatically. If the flag is not specified, all backend config files will be written to the corresponding terraform component folders.

--stacks (optional)

Only process the specified stacks (comma-separated values). The names of top-level stack manifests and Atmos stack names are supported.

--components (optional)

Only generate backend files for the specified Atmos components (comma-separated values).

--format (optional)

Backend file format: json, hcl, backend-config (json is default) .

--dry-run (optional)

Dry run.

info

Refer to Terraform backend configuration for more details on terraform backends and supported formats