Skip to content

ResourceIdentity: Add support for import by identity and update pass-through implementations #1126

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

Merged
merged 4 commits into from
Apr 14, 2025

Conversation

austinvalle
Copy link
Member

This PR adds support for plannable import by resource identity, which is first supported in Terraform v1.12.0-beta1.


Today, the only supported plannable import data is the id field, which is just a string that provider typically just redirects to the import stub state :

import {
  to = aws_route53_record.myrecord
  id = "Z4KAPRWWNC7JR_dev.example.com_NS"
}

Now, if the resource supports identity, the import block will allow the identity to be supplied in the identity attribute:

import {
  to = aws_route53_record.myrecord
  identity = {
    zone_id = "Z4KAPRWWNC7JR"
    record_name = "dev.example.com"
    record_type = "NS"
  }
}

The identity is automatically passed through to the Read implementation, which typically does the heavy lifting for populating state of an imported resource, however the provider can choose to populate the identity with more information, set data in the import stub state, etc.

@austinvalle austinvalle added the enhancement New feature or request label Apr 3, 2025
@austinvalle austinvalle added this to the v1.15.0 milestone Apr 3, 2025
@austinvalle austinvalle requested a review from a team as a code owner April 3, 2025 16:09
Copy link
Member Author

Choose a reason for hiding this comment

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

One thing not included in this PR is an implementation of an "identity => import stub state" pass-through. I'm still not 100% sure what provider developers will prefer in-terms of helper functions, but we can easily create a new one if needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

My plan was to release a framework 1.15.0-beta.1 with this PR (along with Rain's currently open #1125 and #1123 )

Copy link
Contributor

@bbasata bbasata left a comment

Choose a reason for hiding this comment

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

:shipit:

@austinvalle austinvalle merged commit db08a72 into main Apr 14, 2025
36 checks passed
@austinvalle austinvalle deleted the av/import-identity branch April 14, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants