Terraform-equinix-migration-tool - Tool to migrate code from Equinix Metal terraform provider to Equinix terraform provider

Equinix Terraform Provider Migration Tool

This tool targets a terraform working directory and transform all* metal or packet names found in .tf and .tfstate files to the equinix provider name. It creates a backup of the target directory <working-directory>.backup as a sibling folder.

*The migration process does not transform variable names or comments even if they contain metal or packet prefixes.

Provider Setup and Config Verification

The migration process transforms the metal or packet provider blocks as well as required_providers in the terraform block and, if included, it comments the attribute version to take the latest available of the equinix provider:

From:

terraform {
  required_providers {
    packet = {
      source   = "packethost/packet"
      version = "3.2.1"
    }
  }
}

provider "packet" {
  auth_token = var.auth_token
}

To:

terraform {
  required_providers {
    equinix = {
      source   = "equinix/equinix"
      #version = "3.2.1"
    }
  }
}

provider "equinix" {
  auth_token = var.auth_token
}

NOTE

If your code already includes both equinix provider and metal | packet, the resulting code will have two equinix provider blocks and they will also be duplicated in the required_providers definition. If this is your case, after migrate, you must manually combine them in a single one that includes all the required parameters:

From:

provider "equinix" {
  auth_token = var.auth_token
}
provider "equinix" {
  client_id = var.client_id
  client_secret = var.client_secret
}

To:

provider "equinix" {
  auth_token = var.auth_token
  client_id = var.client_id
  client_secret = var.client_secret
}

If you have any other requirements in the provider definition that this tool does not address, you will need to manually modify them after running a migration.

Remote State

The equinix-terraform-tool does not support remote state. If you are using remote state, then the recommended approach is to copy the state file locally, run the equinix-terraform-tool, and then push the state file back to the remote location. See the documentation here for details about how to unconfigure and reconfigure your backend.

Using the tool

To migrate your terraform project, follow these steps:

From the project directory, run terraform plan, make sure there are no pending changes in your plan.

Execute the equinix-terraform-tool binary, passing the path to your project directory, example:

equinix-terraform-tool migrate -dir=<project-path>

After migrating, run terraform plan again and verify there are no new pending modifications.

For Terraform v.10+, you will need to initialize terraform for the directory using terraform init

If the migration was not successful, manually restore the project files from the .backup directory or run:

equinix-terraform-tool backup -dir=<project-path> -restore

After you have verified the migration was successful, delete the backup directory or run:

equinix-terraform-tool backup -dir=<project-path> -purge

Credits

Based on OCI Provider migration tool - Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

Owner
Equinix
Equinix is the world's digital infrastructure company.
Equinix
Similar Resources

Quick start repository for creating a Terraform provider using terraform-plugin-framework

Terraform Provider Scaffolding (Terraform Plugin Framework) This template repository is built on the Terraform Plugin Framework. The template reposito

Dec 15, 2022

Terraform Provider Scaffolding (Terraform Plugin SDK)

Terraform Provider Scaffolding (Terraform Plugin SDK) This template repository is built on the Terraform Plugin SDK. The template repository built on

Feb 8, 2022

Kubedd – Check migration issues of Kubernetes Objects while K8s upgrade

Kubedd – Check migration issues of Kubernetes Objects while K8s upgrade

Dec 19, 2022

Kstone is an etcd management platform, providing cluster management, monitoring, backup, inspection, data migration, visual viewing of etcd data, and intelligent diagnosis.

Kstone is an etcd management platform, providing cluster management, monitoring, backup, inspection, data migration, visual viewing of etcd data, and intelligent diagnosis.

Kstone 中文 Kstone is an etcd management platform, providing cluster management, monitoring, backup, inspection, data migration, visual viewing of etcd

Dec 27, 2022

Terraform-in-Terraform: Execute Modules directly from the Terraform Registry

Terraform-In-Terraform Provider This provider allows running Terraform in Terraform. This might seem insane but there are some edge cases where it com

Dec 25, 2022

provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters

provider-kubernetes provider-kubernetes is a Crossplane Provider that enables deployment and management of arbitrary Kubernetes objects on clusters ty

Dec 14, 2022

Provider-generic-workflows - A generic provider which uses argo workflows to define the backend actions.

provider-generic-workflows provider-generic-workflows is a generic provider which uses argo workflows for managing the external resource. This will re

Jan 1, 2022

Provider-milvus - Milvus provider for crossplane

provider-milvus provider-milvus is a minimal Crossplane Provider that is meant t

Feb 9, 2022
Terraform provider to help with various AWS automation tasks (mostly all that stuff we cannot accomplish with the official AWS terraform provider)
Terraform provider to help with various AWS automation tasks (mostly all that stuff we cannot accomplish with the official AWS terraform provider)

terraform-provider-awsutils Terraform provider for performing various tasks that cannot be performed with the official AWS Terraform Provider from Has

Dec 8, 2022
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)

Terraform Provider for Azure (Resource Manager) Version 2.x of the AzureRM Provider requires Terraform 0.12.x and later, but 1.0 is recommended. Terra

Oct 16, 2021
Terraform-provider-mailcow - Terraform provider for Mailcow

Terraform Provider Scaffolding (Terraform Plugin SDK) This template repository i

Dec 31, 2021
Terraform-provider-buddy - Terraform Buddy provider For golang

Terraform Provider for Buddy Documentation Requirements Terraform >= 1.0.11 Go >

Jan 5, 2022
Terraform-provider-vercel - Terraform Vercel Provider With Golang

Vercel Terraform Provider Website: https://www.terraform.io Documentation: https

Dec 14, 2022
Terraform-provider-age - Age Terraform Provider with golang

Age Terraform Provider This provider lets you generate an Age key pair. Using th

Feb 15, 2022
OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)
OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)

Terraform Provider OpenAPI This terraform provider aims to minimise as much as possible the efforts needed from service providers to create and mainta

Dec 26, 2022
Hashicups-tf-provider - HashiCups Terraform Provider Tutorial

Terraform Provider HashiCups Run the following command to build the provider go

Jan 10, 2022
sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC), and Everything as Code. So it is a tool for DevOps.

sail 中文文档 sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC),a

Dec 16, 2021
Terraform utility provider for constructing bash scripts that use data from a Terraform module

Terraform Bash Provider This is a Terraform utility provider which aims to robustly generate Bash scripts which refer to data that originated in Terra

Sep 6, 2022