Terraform
- Terraform Enterprise
- 1.0.x (latest)
- v202507-1
- v202506-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- v202408-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
tf-migrate configuration file reference
This topic describes the parameters for configuring the tf-migrate CLI.
Configuration model
A tf-migrate configuration file supports the following parameters.
- skip-dir: list of strings
- projects: list of objects- dir: string
- workspaces: list of objects- name: string
- env-vars:
- terraform-vars: list of strings
 
 
Specification
This section provides details about the fields you can configure in a tf-migrate configuration file.
skip-dir
Specifies a list of paths to directories you want tf-migrate to skip. This parameter is identical to using the -skip-dir command-line flag. By default,  tf-migrate processes all child directories containing Terraform configuration files.
- Data type: List of strings
- Default: None
projects
Specifies a list of project configurations that align with local directories. The tf-migrate tool creates one project in HCP Terraform or Terraform Enterprise per configuration. In each project, tf-migrate creates one workspace per local workspace.
- Data type: List of objects
- Default: None
projects.dir
Specifies the relative or absolute path to the Terraform configuration to migrate.
- Data type: String
- Default: None
projects.workspaces
Specifies workspace configurations in the project. Terraform creates a workspace in HCP Terraform or Terraform Enterprise for each workspace configuration. The following table describes the attributes you can configure in each item in the list of workspaces:
| Attribute | Description | Data type | Default | 
|---|---|---|---|
| name | Specifies the name of the local workspace. | String | None | 
| env-vars | Specifies a map of environment variables to set during the migration. Each key must start with TF_VAR. You must specifyenv-vars,terraform-vars, or both. | Object | None | 
| terraform-vars | Specifies a list of Terraform variables files to use for configuring the workspace. Each file must end with either .tfvarsortfvars.json. You must specifyterraform-vars,env-vars, or both. The path can be a relative or absolute path. | List of strings | None | 
- Data type: List of objects
- Default: None
Example configuration file
In the following example, Terraform creates one project using data from the example/project1 directory. The project has a workspace named staging and a workspace named dev:
skip-dir = ["example/skip/dir1", "example/skip/dir2"]
projects = [
    {
        dir = "example/project1"
        workspaces = [
            {
                name = "staging"
                env-vars = {
                    "TF_VAR_region": "us-east-2"
                }
                terraform-vars = ["staging.tfvars"]
            },
            {
                name = "dev"
                terraform-vars = ["dev.tfvars"]
            }
        ]
    }
]