Skip to main content

atmos terraform generate backends

purpose

Use this command to generate the Terraform backend config files for all Atmos terraform components in 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

FlagDescriptionAliasRequired
--file-templateBackend 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
no
--stacksOnly process the specified stacks (comma-separated values).
The names of top-level stack manifests and Atmos stack names are supported
no
--componentsOnly generate backend files for the specified Atmos components
(comma-separated values)
no
--formatBackend file format: hcl, json, backend-config (hcl is default)no
--dry-runDry runno

info

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