Skip to content

Conversation

@SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Nov 14, 2025

I realised that the code for calling RPC methods had leaked through the code further than intended, so this PR updates calling code in Meta methods and ensures that configuring a state store is only done via the backend.Backend interface.

Target Release

1.15.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Nov 14, 2025
…tead of an instance of the `backend.Backend` interface.
…e, instead of directly using methods related to RPCs. This requires changing where we call `SetStateStoreChunkSize`.
To summarize, we don't really need the `SetStateStoreChunkSize` method, and instead methods like `(*GRPCProvider).ConfigureStateStore` in the `plugin6` package can directly inspect the negotiation process that passes through that code and pull out the chunk size. However that means that that code would also need to implement validation. And that's just `(*GRPCProvider).ConfigureStateStore`; what about all the test mocks that are used in different types of test? They would all need to be implemented similarly to GRPCProvider to be good, useful mocks, and then a lot of things that fulfil the provider.Interface interface are coupled to each other. Instead, it's easier to have validation in the `grpcClient` struct's methods in the `remote` package, as that code is common to all scenarios. That code needs a method to 'reach into'  the provider.Interface value, so we use the `SetStateStoreChunkSize` method.
@SarahFrench SarahFrench force-pushed the pss/use-interface-configure-store branch from 97dd6bf to a38298d Compare November 14, 2025 20:47
I'm surprised that removing this doesn't break E2E tests of PSS that use grpcwrap, but I think there's `plugin6` code that runs in that situation, so maybe chunking is handled elsewhere.
@SarahFrench
Copy link
Member Author

f848219 did its job by highlighting the changes needed in a8f76c1 🥲

if cs, ok := p.provider.(providers.StateStoreChunkSizeSetter); ok {
cs.SetStateStoreChunkSize(p.typeName, int(chunkSize))
} else {
// TODO: Remove
Copy link
Member Author

Choose a reason for hiding this comment

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

It feels like leaving this in would be helpful, any objections?

Comment on lines -2038 to -2056
validateResp := provider.ValidateProviderConfig(providers.ValidateProviderConfigRequest{
Config: providerConfigVal,
})
diags = diags.Append(validateResp.Diagnostics)
if diags.HasErrors() {
return nil, diags
}

configureResp := provider.ConfigureProvider(providers.ConfigureProviderRequest{
TerraformVersion: tfversion.SemVer.String(),
Config: providerConfigVal,
})
diags = diags.Append(configureResp.Diagnostics)
if diags.HasErrors() {
return nil, diags
}

// Validate and configure the state store
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 think this should be behind an interface similar to backend.Backend, and I guess that interface would also live in the pluggable package.

@SarahFrench SarahFrench marked this pull request as ready for review November 17, 2025 16:40
@SarahFrench SarahFrench requested a review from a team as a code owner November 17, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant