Skip to main content

atmos terraform migrate plan

Use atmos terraform migrate plan to preview a user-authored tfmigrate migration for an Atmos Terraform component.

Experimental
atmos terraform migrate plan --help


       
 
         
         
          
               

👽 test darwin/arm64

Compute a migrated Terraform state with tfmigrate

USAGE

                                                        
    $ atmos terraform migrate plan [component] [flags]  
                                                        

FLAGS

      --affected                           Run migrations for the affected components in dependency order

      --all                                Run migrations for all components in all stacks

      --auto-generate-backend-file string  Override auto_generate_backend_file setting from atmos.yaml (true/false)

      --backend-config strings             Backend configuration passed to tfmigrate; may be specified multiple times

  -h, --help                               help for plan

      --init-run-reconfigure string        Override init_run_reconfigure setting from atmos.yaml (true/false)

      --migration string                   Path to a single tfmigrate migration file. Omit to let tfmigrate run history mode

      --tfmigrate-config string            Override tfmigrate config path. Defaults to tfmigrate discovery


GLOBAL FLAGS

      --ai                        Enable AI-powered analysis of command output

      --append-user-agent string  Customize User-Agent string in Terraform provider requests (sets
                                  TF_APPEND_USER_AGENT)

      --base-path string          Base path for Atmos project

  -C, --chdir string              Change working directory before executing the command (run as if Atmos started in
                                  this directory)

      --clone-target-ref          Clone the target reference with which to compare the current branch

      --components strings        Filter by specific components

      --config strings            Paths to configuration files (comma-separated or repeated flag)

      --config-path strings       Paths to search for Atmos configuration (comma-separated or repeated flag)

      --dry-run                   Perform dry run without making actual changes

      --force-color               Force color output even when not a TTY (useful for screenshots)

      --force-tty                 Force TTY mode with sane defaults when terminal detection fails (useful for
                                  screenshots)

      --heatmap                   Show performance heatmap visualization after command execution (includes P95
                                  latency)

      --heatmap-mode string       Heatmap visualization mode: bar, sparkline, table (press 1-3 to switch in TUI)
                                  (default bar)

  -i, --identity string           Specify the identity to authenticate to before running Terraform commands. Use
                                  without value to interactively select.

      --include-dependents        For each affected component, detect the dependent components and process them in the
                                  dependency order

      --init-pass-vars            Pass the generated varfile to terraform init using --var-file flag (OpenTofu feature)

      --interactive               Enable interactive prompts for missing required flags, optional value flags using
                                  the sentinel pattern, and missing positional arguments (requires TTY, disabled in
                                  CI) (default true)

      --logs-file string          The file to write Atmos logs to. Logs can be written to any file or any standard
                                  file descriptor, including '/dev/stdout', '/dev/stderr' and '/dev/null' (default
                                  /dev/stderr)

      --logs-level string         Logs level. Supported log levels are Trace, Debug, Info, Warning, Off. If the log
                                  level is set to Off, Atmos will not log any messages (default Warning)

      --mask                      Enable automatic masking of sensitive data in output (use --mask=false to disable)
                                  (default true)

      --no-color                  Disable color output

      --pager string              Enable pager for output (--pager or --pager=true to enable, --pager=false to disable, --
                                  pager=less to use specific pager)

      --process-functions         Enable/disable YAML functions processing in Atmos stack manifests (default true)

      --process-templates         Enable/disable Go template processing in Atmos stack manifests (default true)

      --profile strings           Activate configuration profiles (comma-separated or repeated flag)

      --profile-file string       Write profiling data to file instead of starting server

      --profile-type string       Type of profile to collect when using --profile-file. Options: cpu, heap, allocs,
                                  goroutine, block, mutex, threadcreate, trace (default cpu)

      --profiler-enabled          Enable pprof profiling server

      --profiler-host string      Host for pprof profiling server (default localhost)

      --profiler-port int         Port for pprof profiling server (default 6060)

  -q, --query string              Execute atmos terraform command on components filtered by a YQ expression

      --redirect-stderr string    File descriptor to redirect stderr to. Errors can be redirected to any file or any
                                  standard file descriptor (including '/dev/null')

      --ref string                Git reference with which to compare the current branch

      --repo-path string          Filesystem path to the already cloned target repository with which to compare the
                                  current branch

      --sha string                Git commit SHA with which to compare the current branch

      --skill strings             Specify skills for AI analysis context (comma-separated or repeated flag, requires --
                                  ai)

      --skip strings              Skip executing specific YAML functions in the Atmos stack manifests

      --skip-hooks string         Skip lifecycle hooks for this invocation. Use --skip-hooks (no value) to skip all, or --
                                  skip-hooks=name1,name2 to skip specific hooks by name

      --skip-init                 Skip terraform init before running command

      --ssh-key string            Path to PEM-encoded private key to clone private repos using SSH

      --ssh-key-password string   Encryption password for the PEM-encoded private key if the key contains a password-
                                  encrypted PEM block

  -s, --stack string              Stack name

      --upload-status             Upload plan status to Atmos Pro

      --use-version string        Use a specific version of Atmos (e.g., --use-version=1.160.0)

  -v, --verbose                   Enable verbose error output with full context, stack traces, and detailed
                                  information


COMPATIBILITY FLAGS

  These flags are passed through to the underlying terraform/tofu command.

      -compact-warnings     Show warnings in a more compact form
      -destroy              Create a plan to destroy all remote objects
      -detailed-exitcode    Return detailed exit codes (0=success, 1=error, 2=changes)
      -generate-config-out  Write HCL for resources to import
      -input                Ask for input for variables if not directly set (default: true)
      -json                 Output plan in a machine-readable JSON format
      -lock                 Lock the state file when locking is supported (default: true)
      -lock-timeout         Duration to retry a state lock (default: 0s)
      -no-color             Disable color output in the command output
      -out                  Write the plan to the given path
      -parallelism          Limit the number of concurrent operations (default: 10)
      -refresh              Update state prior to checking for differences (default: true)
      -refresh-only         Create a plan to update state only (no resource changes)
      -replace              Force replacement of a particular resource instance
      -target               Target specific resources for planning/applying
      -var                  Set a value for one of the input variables
      -var-file             Load variable values from the given file

Usage

atmos terraform migrate plan [component] -s <stack> [options]

Arguments

component
Atmos Terraform component to migrate. Omit when selecting multiple components with --all, --components, --query, or --affected.

Flags

--stack / -s
Atmos stack where the component is defined.
--identity / -i
Identity to authenticate before resolving the component and running tfmigrate plan. Environment variable: ATMOS_IDENTITY.
--migration
Path to a single tfmigrate migration file, relative to migration_dir. Do not include the migration_dir prefix. migration_dir defaults to ./migrations when that directory exists in the component, otherwise it defaults to the component root. Omit this flag to let tfmigrate run history mode.
--tfmigrate-config
Override the tfmigrate config path. Atmos checks, in order: this flag or ATMOS_TFMIGRATE_CONFIG, then TFMIGRATE_CONFIG, then a .tfmigrate.hcl file in the component. When none of these are set, Atmos generates a config that reuses the component's Terraform backend as history storage.
--backend-config
Backend config entry passed to tfmigrate --backend-config. Repeat the flag for multiple entries.
--all
Run the migration plan for all selected component instances.
--components
Run the migration plan for the listed component names.
--query
Run the migration plan for component instances matching a YQ expression.
--affected
Run the migration plan for affected Terraform components. --include-dependents is not supported for migrate yet.
--skip-init
Skip the normal Terraform init path before tfmigrate runs.

Examples

Preview history-mode migrations:

atmos terraform migrate plan s3-bucket -s plat-ue2-dev

Preview with an explicit identity:

atmos terraform migrate plan s3-bucket -s plat-ue2-dev --identity aws-prod

Preview a single-file migration:

atmos terraform migrate plan s3-bucket -s plat-ue2-dev --migration 001_remove_template_provider.hcl

tfmigrate resolves the value relative to the migration_dir in its config. Pass just the filename when migration_dir already points at your migrations directory.

Preview migrations across selected components:

atmos terraform migrate plan --all --components s3-bucket
atmos terraform migrate plan --query '.settings.requires_migration == true'

Override the default tfmigrate config path:

atmos terraform migrate plan s3-bucket -s plat-ue2-dev --tfmigrate-config migrations/.tfmigrate.hcl