Skip to content
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

makeResourceRawConfig hides unschematized fields #1977

Open
t0yv0 opened this issue May 15, 2024 · 2 comments
Open

makeResourceRawConfig hides unschematized fields #1977

t0yv0 opened this issue May 15, 2024 · 2 comments
Labels
kind/engineering Work that is not visible to an external user

Comments

@t0yv0
Copy link
Member

t0yv0 commented May 15, 2024

This is a subtle change in behavior from DiffStrategy=Classic to DiffStrategy=PlanState uncovered by the test suite when
testing PlanState in the following PR:

#1976

The failing tests highlight a change in how un-schematized fields are exposed to the provider in RawConfig during Read.
Before the change, the user program could have a property set in the inputs that is not present in the schema, and this
property would get inflected into a Pulumi naming convention and get exposed in RawConfig.

It is peculiar that this would happen with an implicit warning:

return makeResourceRawConfigClassic(config, resource)

makeResourceRawConfigClassic would swallow an error from CoerceValue stating:

    unexpected attribute "raw_config_value"

And then would continue recovering raw config on the approximate path:

    // Once more, choosing to proceed with a slightly incorrect value rather than fail fast.
    glog.V(9).Infof("failed to coerce config: %v", err)
    return original

Assuming this functionality is very rarely relied on, but if it was needed, we should consider implementing this
differently to avoid triggering the panic in CoerceValue, first splitting the data into schematized and un-schematized
parts, then calling CoerceValue on the schematized parts, and then joining the translated unschematized parts back.

@VenelinMartinov
Copy link
Contributor

Have we observed any providers relying on this behaviour?

@t0yv0
Copy link
Member Author

t0yv0 commented May 15, 2024

Haven't observed this yet being relied on in the actually user-facing providers, just in the test suite.

@t0yv0 t0yv0 added the kind/engineering Work that is not visible to an external user label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/engineering Work that is not visible to an external user
Projects
None yet
Development

No branches or pull requests

2 participants