Skip to content

Add state migration for federated_identity_credential parent_id deprecation#32169

Closed
utafrali wants to merge 1 commit intohashicorp:mainfrom
utafrali:fix/issue-32074-deprecation-of-parent-id-in-azurerm-fede
Closed

Add state migration for federated_identity_credential parent_id deprecation#32169
utafrali wants to merge 1 commit intohashicorp:mainfrom
utafrali:fix/issue-32074-deprecation-of-parent-id-in-azurerm-fede

Conversation

@utafrali
Copy link
Copy Markdown

Fixes #32074

Description

The deprecation of parent_id in favor of user_assigned_identity_id was breaking for users with existing state. Added a state migration to handle the upgrade path so existing resources don't break when users upgrade the provider.

PR Checklist

  • Followed Contributing Documentation
  • Updated/added Documentation
  • Written new tests

Changes to existing Resource / Data Source

Updated FederatedIdentityCredentialResource to implement ResourceWithStateMigration and added the StateUpgraders() method that registers the v0 to v1 migration. The migration logic copies the value from parent_id to user_assigned_identity_id.

Testing

Added TestAccFederatedIdentityCredential_parentIdToUserAssignedIdentityId which verifies the migration works by creating a resource with the old config and upgrading to the new one. The test is gated with the feature flag so it only runs on pre-5.0 versions.

Change Log

N/A

Related Issue(s)

Closes #32074

AI Assistance Disclosure

N/A

@sreallymatt
Copy link
Copy Markdown
Collaborator

Hi @utafrali - Thanks for your interest in contributing to the provider!

While this change does technically resolve the linked issue, since this is only a problem when running a plan/apply operation without a refresh step (i.e. terraform plan -refresh=false), we are not going to merge this state migration.

State migrations are one-way only, meaning as soon as this is merged, users will no longer be able to downgrade to a previous minor version of the provider which is arguably a bigger issue than needing to run a plan/apply operation with a refresh (which the majority of users likely already do)

Because of this, I'm going to close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation of parent_id in azurerm_federated_identity_credential is breaking

2 participants