Open justinvp opened 2 years ago
Note that we may not be able to blanket turn back on passing input args for components. We have components in AWSX that stuff extra things (like resource options) in the args to make them available from the component’s initialize
method, and Cyrus’s comment at https://github.com/pulumi/pulumi/pull/2296#issuecomment-447709691 leads me to believe there may be other things in our first-party component inputs that can cause issues (i.e. cycles). So there is some design work needed here to think through how we can enable this in a way that doesn’t break existing usage.
Once we have the inputs in state, could we also pass them to Construct
as olds
? For example, this would enable the Chart v4 resource to reject changes to the resourcePrefix
property.
A couple others scenarios this would enable:
Once we have the inputs in state, could we also pass them to Construct as olds?
Not easily. Construct is called from a different part of the system to the part that knows about old state
We were looking here recently for the use case of collecting stats on the distribution of input parameter values for component resources to make informed decisions about deprecation and such (provided EULA permits this use). Could be very interesting to have this data in the state, and if not then perhaps in the engine logs (--event-logs option). Currently not available there either.
A long time ago, a decision was made to not pass component resource properties to the engine: https://github.com/pulumi/pulumi/pull/2296 (more details: https://github.com/pulumi/pulumi/pull/2296#issuecomment-447709691).
However, this prevents component resource properties from being available from policies (and other analyzers), from unit test mocks, from display in the Pulumi Service, etc.
We should reconsider this behavior as there are certainly valid reasons why someone would want to inspect or test a component’s properties.
References