Skip to main content

atmos terraform workspace new

Use this command to create a new Terraform workspace for an Atmos component in a stack.

atmos terraform workspace new --help

Usage

Execute the terraform workspace new command like this:

atmos terraform workspace new <component> -s <stack> [workspace-name] [options]

This command creates a new Terraform workspace. If no workspace name is provided, Atmos calculates the appropriate workspace name from the component's context variables and stack configuration.

tip

Run atmos terraform workspace new --help to see all the available options

Examples

# Create a new workspace (auto-calculated from stack context)
atmos terraform workspace new vpc -s dev

# Create a workspace with a specific name
atmos terraform workspace new vpc -s dev my-workspace

Arguments

component (required)

Atmos terraform component.

workspace-name (optional)

The name of the workspace to create. If not provided, Atmos calculates the workspace name from the stack context.

Flags

--stack (alias -s) (required)

Atmos stack.

--dry-run (optional)

Show what would be executed without actually running the command.

atmos terraform workspace new vpc -s dev --dry-run
--skip-init (optional)

Skip running terraform init before executing the command.

atmos terraform workspace new vpc -s dev --skip-init

Native Terraform Flags

The atmos terraform workspace new command supports native terraform workspace new flags. Pass them directly or use -- to separate Atmos flags from Terraform flags.

-lock=true

Lock the state file when locking is supported. Defaults to true.

atmos terraform workspace new vpc -s dev -lock=false my-workspace
-lock-timeout=DURATION

Duration to retry a state lock. Defaults to 0s.

atmos terraform workspace new vpc -s dev -lock-timeout=30s my-workspace
-state=FILE

Path to a local state file to use for the new workspace's initial state.

atmos terraform workspace new vpc -s dev -state=initial.tfstate my-workspace

See Also