Skip to content

Resource Identity: Add identity data to RPCs needed to store/read from state #1112

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 23 commits into from
Mar 18, 2025

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Mar 14, 2025

Currently pointed at #1107

This PR allows a framework provider to store/read identity data for a managed resource (along with Terraform v1.12.0-alpha20250312). The RPCs implemented for this are ReadResource (Read), PlanResourceChange, and ApplyResourceChange (split in framework to Create/Update/Delete).

I left some intentional TODOs for pieces of work I wasn't 100% sure of that should be resolved before we release stable v1.15.0.


Generally, the flow of data through the packages (using protocol v5 as an example, it's the same for v6):

  • proto5server (implements the RPC in plugin-go) => fromproto5 (maps request from plugin-go types to fwserver types)
  • proto5server => fwserver (this is where any framework-specific logic is implemented for the RPC)
    • fwserver => resource (the actual provider code for the resource, like aws or azurerm)
  • proto5server => toproto5 (maps response from fwserver types to plugin-go types)

The other RPCs that are not needed to successfully test the happy path of plan/apply workflow, these will be implemented in follow-up PRs:

  • ImportResourceState
  • MoveResourceState
  • UpgradeResourceIdentity

@austinvalle austinvalle added the enhancement New feature or request label Mar 14, 2025
@austinvalle austinvalle added this to the v1.15.0 milestone Mar 14, 2025
@austinvalle austinvalle requested a review from a team as a code owner March 14, 2025 13:02
@austinvalle
Copy link
Member Author

austinvalle commented Mar 14, 2025

Using the core alpha, storing identity via Read/Create/Update looks like the following:
image

No validation yet on the immutability of identity, but more to come there!

ansgarm
ansgarm previously approved these changes Mar 17, 2025
Copy link
Member

@ansgarm ansgarm left a comment

Choose a reason for hiding this comment

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

@@ -96,6 +98,17 @@ func (s *Server) DeleteResource(ctx context.Context, req *DeleteResourceRequest,
resp.Private = req.PlannedPrivate
}

// If the resource supports identity pre-populate a null value.
// TODO:ResourceIdentity: This should probably be prior identity, but we don't currently have that in the protocol.
Copy link
Member

Choose a reason for hiding this comment

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

should we / did you already mention this to core?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did in the RFC here -> https://docs.google.com/document/d/1jvNfineZgXaKFP5djLkMxXKf9s6Xq-FzBV3p2jHGbiI/edit?disco=AAABe6K13yk

It's unclear whether planned_identity will contain the prior_identity value, but I think it's generally agreed upon that the prior identity will be provided in some fashion 😆

SBGoods
SBGoods previously approved these changes Mar 17, 2025
@rainkwan
Copy link

LGTM as well 👍🏽

Base automatically changed from feat/resource-identity to main March 18, 2025 20:05
@austinvalle austinvalle dismissed stale reviews from SBGoods and ansgarm March 18, 2025 20:05

The base branch was changed.

@austinvalle austinvalle merged commit a31ec4a into main Mar 18, 2025
33 checks passed
@austinvalle austinvalle deleted the feat/resource-identity_data-req-resp branch March 18, 2025 20:16
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.

5 participants