Generate valid Terraform configuration from state.


go install[email protected]


The goal of this tool is to improve the import experience of Terraform, that rather than constructing the configurations from scratch, tfadd (try its best to) provide users a valid configuration automatically.

The valid here means the generated configuration should raise no error and show no diff during terraform plan.

The typical usage is to use tfadd together with terraform import:

  1. Prepare an empty workspace (e.g. an empty directory for local backend)
  2. (tfadd only) Run tfadd setup [providers...] > to populate the Terraform setting to pin the provider version
  3. Run terraform init to initialize the providers
  4. Identify the existing resources to be managed via terraform, write down the empty resource block and import them via terraform import
  5. (tfadd only) Run tfadd run to generate the configuration

Currently, the tool supports the following providers:



No inter-resource dependency generated.


View Github