Importing your Polytomic workspace into Terraform
The Polytomic Importer tool offers an easy way to import everything in your Polytomic workspace into your Terraform HCL.
Installation
Download the latest binary from the available releases: https://github.com/polytomic/terraform-provider-polytomic/releases.
Usage
Run the importer to generate HCL terraform files to the specified output directory. The importer will generate a set of .tf
files along with a shell script, import.sh
.
polytomic-importer run --api-key <API KEY> --output <DIRECTORY>
Initialize the provider and import the generated terraform resources into state using the generated shell script.
cd ${DIRECTORY}
terraform init
./import.sh
Finally, run apply to ensure any datasources and outstanding state is synchronized.
terraform apply
Changes in plan
Some resources may be marked as needed to be
updated in-place
in the terraform plan. It is safe to apply those changes.
Github Action
A Github Action to run the Polytomic Importer can be found on the GitHub Marketplace: https://github.com/marketplace/actions/polytomic-terraform-sync.
Polytomic also offers a template repository for running periodic imports to keep the UI and Terraform configuration in sync.
Updated 6 months ago