coder / coder/terraform-provider-coder

Migrate to Terraform Plugin Framework

Open
#180 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
60
Forks
27
Avg merge
1d 21h
Merged PRs (30d)
2

Description

Terraform recommends migrating to [Terraform Plugins Framework](https://developer.hashicorp.com/terraform/plugin/framework) as it provides some benefits over the SDKv2.
1. https://developer.hashicorp.com/terraform/plugin/framework-benefits/
2. https://developer.hashicorp.com/terraform/plugin/framework/migrating/benefits

## Docs

Terraform Plugin Framework
Develop Terraform providers using the recommended plugin framework.

The plugin framework is HashiCorp’s recommended way develop Terraform Plugins on [protocol version 6](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol#protocol-version-6) or [protocol version 5](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol#protocol-version-5).

We recommend using the framework to develop new providers because it offers significant advantages as compared to [Terraform Plugin SDKv2](https://developer.hashicorp.com/terraform/plugin/sdkv2). We also recommend migrating existing providers to the framework when possible. Refer to [Plugin Framework Benefits](https://developer.hashicorp.com/terraform/plugin/framework-benefits) for higher level details about how the framework makes provider development easier and [Plugin Framework Features](https://developer.hashicorp.com/terraform/plugin/framework/migrating/benefits) for a detailed functionality comparison between the SDKv2 and the framework.

### Get Started
Try the [Terraform Plugin Framework tutorials](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework).
Clone the [terraform-provider-scaffolding-framework](https://github.com/hashicorp/terraform-provider-scaffolding-framework) template repository on GitHub.

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

1. Ensure all [tests](https://developer.hashicorp.com/terraform/plugin/framework/migrating/testing#testing-migration) pass.
2. Consider [finding SDKv2 resource data consistency errors](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/data-consistency-errors), which might affect migrating to the Framework. Some errors can be resolved and verified with SDKv2 code before migration, if desired, otherwise resolving these errors must be [part of the migration](https://developer.hashicorp.com/terraform/plugin/framework/migrating/resources/crud#resolving-data-consistency-errors).
3. [Serve the provider](https://developer.hashicorp.com/terraform/plugin/framework/migrating/providers#serving-the-provider) via the Framework.
1. Implement [muxing](https://developer.hashicorp.com/terraform/plugin/framework/migrating/mux), if you plan to migrate the provider iteratively.
4. Update the [provider definition](https://developer.hashicorp.com/terraform/plugin/framework/migrating/providers#provider-definition) to use the Framework.
5. Update the [provider schema](https://developer.hashicorp.com/terraform/plugin/framework/migrating/providers#provider-schema).
6. Update each of the provider's resources and data sources.
1. Update related [tests](https://developer.hashicorp.com/terraform/plugin/framework/migrating/testing) to use the Framework, and ensure that the tests fail.
2. Migrate the [resource](https://developer.hashicorp.com/terraform/plugin/framework/migrating/resources) or [data source](https://developer.hashicorp.com/terraform/plugin/framework/migrating/data-sources).
3. Verify that related tests now pass.
7. If you used [muxing](https://developer.hashicorp.com/terraform/plugin/framework/migrating/mux), remove the muxing configuration.

Depends on #222

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.