Error while performing migration test from sdkv2 to plugin for IAM role

Currently I have this branch I am working on to upgrade IAM role from terraform-plugin-sdkv2 to the terraform-plugin-framework. I have most of the core functionally working via the existing tests, and I was about to start working on the MigrateFromPluginSDK tests as show in the terraform-plugin-framework docs. To accomplish this, I have created a test called TestAccIAMRole_MigrateFromPluginSDK_basic. When excuting the test, it appears that no diff is generated but I am getting the below failure:

 > make testacc TESTS=TestAccIAMRole_MigrateFromPluginSDK_basic PKG=iam
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRole_MigrateFromPluginSDK_basic'  -timeout 3
=== RUN   TestAccIAMRole_MigrateFromPluginSDK_basic
=== PAUSE TestAccIAMRole_MigrateFromPluginSDK_basic
=== CONT  TestAccIAMRole_MigrateFromPluginSDK_basic
testAccCheckRoleExists ID: tf-acc-test-4766843403163768842
Top of state upgrade
Made it here!
Bottom of state upgrade
Top of state upgrade
Made it here!
Bottom of state upgrade
    testing_new.go:80: Error retrieving state, there may be dangling resources: exit status 1
        Failed to marshal state to json: schema version 0 for aws_iam_role.test in state does not match version 1 from the provid
--- FAIL: TestAccIAMRole_MigrateFromPluginSDK_basic (69.16s)
FAIL        73.754s
make: *** [testacc] Error 1

Now I’m assuming this marshal json error is related to another functionality upgrade I made while doing this migration which was moving inline_policy to inline_policies on the IAM Role resource. I would like to be able to leave this upgrade in this PR as this was my main reason for doing this upgrade toresolve this aws issue . So my main questions is:

  • Can you rename a field on a resource and not receive test errors json marshaling errors? Or is this not something that can/should be done while migrating to the framework?

I would also be happy to help upgrade more resources to the new plugin framework having gone through this process, however I need to resolve this issue first. Please let me know if you need any more information or have any questions. Main files related this are:

Thank you in advance to any help regarding this issue.

Was able to find workaround. Appears to new change with terraform-plugin-testing lib that you can’t use PlanOnly: true with state upgrades anymore. I’ll try to upgrade docs accordingly.

Issue and resolution found here: `Failed to marshal state to json` error when upgrading from 1.5.1 to 1.6.0 · Issue #256 · hashicorp/terraform-plugin-testing · GitHub