Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 2.99 KB

File metadata and controls

47 lines (31 loc) · 2.99 KB
page_title description
Plugin Development: Migrating from SDKv2 to the plugin Framework
Migrate your provider from SDKv2 to the plugin Framework.

Overview

This guide helps you migrate a Terraform provider from SDKv2 to the plugin Framework. We recommend migrating because the Framework has abstractions that make it easier to use, and it represents the future of Terraform plugin development. Refer to Which SDK should I Use? for more details.

This guide provides information and examples for most common use cases, but it does not discuss every nuance of migration. You can ask additional migration questions in the HashiCorp Discuss forum. To request additions or updates to this guide, submit issues or pull requests to the terraform-plugin-framework repository.

In addition to this migration guide, we recommend referring to the main Framework documentation as you migrate your provider.

Requirements

Before you migrate your provider to the Framework, ensure it meets the following requirements:

  • Go 1.18+
  • Built on the latest version of SDKv2
  • The provider is for use with Terraform >= 0.12.0

Muxing

Consider muxing when you need to migrate a provider that contains many resources or data sources. Muxing lets you use two versions of the same provider concurrently, with each serving different resources or data sources. This lets you migrate individual resources or data sources to the Framework one at a time.

Refer to the Combining and Translating documentation for details about muxing configuration.

Testing Migration

As you complete the migration, we recommend that you follow Test Driven Development by writing tests to ensure that the migration does not affect provider behavior. Refer to Testing Migration for details and an example.

Migration steps

Take the following steps when you migrate a provider from SDKv2 to the Framework:

  • Ensure all tests pass.
  • Serve the provider via the Framework.
    • Implement muxing if you plan to migrate the provider over several point releases.
  • Update the provider definition to use the Framework.
  • Update the provider schema.
  • Update each of the provider's resources and data sources.
    • Update related tests to use the Framework, and ensure that the tests fail.
    • Migrate the resource or data source.
    • Verify that related tests now pass.
  • If you used muxing, remove the muxing configuration.