Open ocobles opened 7 months ago
~Noting here that ECX resources are probably not worth migrating, since the ECX API will be shut down this year, after which time the resources can be deleted entirely.~. ECX support was removed in v2.0.0 and I have removed those resources & data sources from the issue description.
We are in the process of migrating all Terraform resources previously defined using the SDKv2 to the Terraform Framework. The utilization of the terraform-plugin-mux Go module has been successfully implemented to facilitate the gradual migration of resources. We have also adopted internal/ layout structure so the resources that are migrated to the framework must now be in their own compartment within internal/{services}/{resource}
Migrate to terraform plugin framework adopt internal/ layout structure #106
Checklist for Unmigrated Resources
Fabric Resources
Metal Resources
Network Edge Resources
Checklist for Unmigrated Datasources
Fabric Datasources
Metal Datasources
Network Edge Datasources
Migration Guide
Code in https://github.com/equinix/terraform-provider-equinix/blob/framework_migr_resources/internal/metal_organization/resource.go should be used as a base to migrate this resource.
Checkout the sdkv2 version https://github.com/equinix/terraform-provider-equinix/blob/main/equinix/resource_metal_organization.go
Checkout official documentation https://developer.hashicorp.com/terraform/plugin/framework/migrating/attributes-blocks/blocks for mapping between SDK Schema Fields and the Framewor. Here's also the link to recommended steps https://developer.hashicorp.com/terraform/plugin/framework/migrating#migration-steps
Code structure:
models.go
resource.go
resource_schema.go
resource_test.go
Schema Review:
Update Imports:
Rename Functions and Variables:
OrganizationResourceModel
toResourceModel
ororganizationResourceSchema
toresourceSchema
).Migrate End-to-End Tests (e2e):
ProtoV5ProviderFactories: acceptance.ProtoV5ProviderFactories
instead ofProviders: testAccProviders
.ssh_key
as a reference,TestAccMetalSSHKey_upgradeFromVersion
.Verification and Testing:
Migrate Equivalent Data Source (if applicable):
datasource.go
datasource_test.go
datasource_schema.go