Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework Migration #791

Merged
merged 18 commits into from
Apr 24, 2023
Merged

Conversation

zliang-akamai
Copy link
Member

@zliang-akamai zliang-akamai commented Apr 12, 2023

📝 Description

  1. Migrating Terraform SDK v2 provider to be Terraform Framework Provider.

  2. Creating mux server for supporting both SDK v2 provider and the framework provider concurrently.

  3. Migrate resource token to Framework provider's resource implementation as an example for the future migration work.

✔️ How to Test

Test the migrated resource:
make PKG_NAME="linode/token" testacc

Test everything else:
make testacc

@zliang-akamai zliang-akamai marked this pull request as ready for review April 17, 2023 18:32
@zliang-akamai zliang-akamai requested a review from a team April 18, 2023 14:39
Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work so far! Just a few suggestions

linode/framework_provider.go Outdated Show resolved Hide resolved
linode/framework_provider_config.go Show resolved Hide resolved
linode/framework_provider_config.go Show resolved Hide resolved
linode/token/framework_resource.go Show resolved Hide resolved
linode/token/framework_validators.go Outdated Show resolved Hide resolved
linode/token/resource_test.go Outdated Show resolved Hide resolved

providers := []func() tfprotov5.ProviderServer{
providerserver.NewProtocol5(
linode.CreateFrameworkProvider(version.ProviderVersion),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgarber-akamai Do you think this is the right way to get version number of the provider?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zliang-akamai Yep! The ProviderVersion is injected into the version package at build-time.

See: https://github.com/linode/terraform-provider-linode/blob/dev/.goreleaser.yml#L13

@zliang-akamai zliang-akamai requested a review from a team April 19, 2023 20:21
@lgarber-akamai
Copy link
Contributor

/acctest sha=3addf8af2acb3f50a5850ca31a7d9d235fddc45d pkg=linode/...

@lgarber-akamai
Copy link
Contributor

No idea if that will work but it's worth a try ^

@zliang-akamai
Copy link
Member Author

@lgarber-akamai
We can also try token resource since it's the only resource placed in the framework provider.

@zliang-akamai
Copy link
Member Author

/acctest sha=3addf8af2acb3f50a5850ca31a7d9d235fddc45d pkg=linode/token

@yec-akamai
Copy link
Contributor

Can you add some description to this PR? It's a large change, will be difficult to understand and maintain in the future without any context.

Copy link
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all relevant tests are passing 🎉

@zliang-akamai
Copy link
Member Author

Can you add some description to this PR? It's a large change, will be difficult to understand and maintain in the future without any context.

Thank you! I just added the description.

@zliang-akamai zliang-akamai requested a review from a team April 21, 2023 20:35
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Test are passing locally 🥳

@zliang-akamai zliang-akamai merged commit 152c99c into linode:dev Apr 24, 2023
3 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/terraform-framework branch April 24, 2023 16:25
ocobles added a commit to equinix/terraform-provider-equinix that referenced this pull request Feb 2, 2024
…asource for metal_ssh_key (#406)

This PR is a first step towards migration from TF SDKv2 to the plugin
Framework. It's along way, and Hashicorp documents it at [0].

We want to have both types of providers exist in the repo until we can
totally migrate to framework. We need to use "muxing" [1].

I base this on the continuous migration of the Linode TF provider [2].
[3] is a first PR where they introduced the framework provider and
migrated `token` resource to the framework format.

For our case, I selected `metal_ssh_key` resource and datasource to
migrate here, because those are simple resource types.

[0] https://developer.hashicorp.com/terraform/plugin/framework/migrating
[1]
https://developer.hashicorp.com/terraform/plugin/framework/migrating/mux
[2] https://github.com/linode/terraform-provider-linode
[3] linode/terraform-provider-linode#791

Towards #365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants