Generate valid Terraform configuration from state.
go install github.com/magodo/tfadd@latest
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.
Currently to generate the state, the tool supports full mode (with -full) or partial mode (by default).
In full mode, tfadd outputs all non-computed properties in the generated config. The generated config might be invalid for kinds of reasons, where manual modification is needed. But the benefit is that it works for any Terraform provider.
In partial mode, tfadd only outputs properties without Optional+Computed properties, with cross property constraints taken into consideration. This mode aims aims to generate a valid Terraform config. Currently, this mode can only works for the following providers:
| Name | Version |
|---|---|
| hashicorp/aws | v5.64.0 |
| hashicorp/azurerm | v4.80.0 |
| hashicorp/azuread | v3.5.0 |
| hashicorp/google | v6.0.1 |
| azure/azapi | v2.10.0 |
The typical usage is to use tfadd together with terraform import:
tfadd init [providers...] > terraform.tf to populate the Terraform setting to pin the provider versionterraform init to initialize the providersterraform importtfadd state or tfadd state -full to generate the configuration513 followers · starred Dec 2022
7 followers · starred Sep 2022
Go
100.0%
Generate valid Terraform configuration from state.
go install github.com/magodo/tfadd@latest
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.
Currently to generate the state, the tool supports full mode (with -full) or partial mode (by default).
In full mode, tfadd outputs all non-computed properties in the generated config. The generated config might be invalid for kinds of reasons, where manual modification is needed. But the benefit is that it works for any Terraform provider.
In partial mode, tfadd only outputs properties without Optional+Computed properties, with cross property constraints taken into consideration. This mode aims aims to generate a valid Terraform config. Currently, this mode can only works for the following providers:
| Name | Version |
|---|---|
| hashicorp/aws | v5.64.0 |
| hashicorp/azurerm | v4.80.0 |
| hashicorp/azuread | v3.5.0 |
| hashicorp/google | v6.0.1 |
| azure/azapi | v2.10.0 |
The typical usage is to use tfadd together with terraform import:
tfadd init [providers...] > terraform.tf to populate the Terraform setting to pin the provider versionterraform init to initialize the providersterraform importtfadd state or tfadd state -full to generate the configuration513 followers · starred Dec 2022
7 followers · starred Sep 2022
Go
100.0%