Pulumi supports a few ways for importing existing cloud resources into your Pulumi stacks. This program will allow you to take an existing Terraform state file and generate a file that the [pulumi import](./pulumi-generate-import-file examples/terraform-vault/terraform.tfstate) CLI command can use to import those resources and generate the corresponding Go, TypeScript, etc. code for the imported resources.
- Build the tool with
make build
- Execute the tool with
./pulumi-generate-import-file ~/path/to/terraform.tfstate
- Copy the output to a
resources.json
or similarly named file- you can also pipe the output directly to a file instead of copying/pasting it
- e.g.
./pulumi-generate-import-file ~/path/to/terraform.tfstate > resources.json
- From your Pulumi project run
pulumi import --file ~/path/to/resources.json
- As of 889a01e, only the Vault provider is supported, but it should be easy to handle additional providers as shown here
- Only v4 terraform state files are supported
- The names of the resource imports will be different than the original Terraform resource name. The
pulumi-generate-import-file
binary will add a prefix to the resource name with the resource type and add a suffix of the resource index. This is primarily due to pulumi/pulumi#6032. Resource aliases can be used to refactor these names after import.