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

Add Python resource transformations support #3319

Merged
merged 5 commits into from
Oct 15, 2019

Conversation

lukehoban
Copy link
Member

@lukehoban lukehoban commented Oct 10, 2019

Adds Python support for resource transformations aligned with the existing NodeJS support in #3174.

This PR also moves processing of transformations to earlier in the resource construction process (for both NodeJS and Python) to ensure that invariants established in the constructor cannot be violated by transformations. This change can technically be a breaking change, but given that (a) the transformations features was just released in 1.3.0 and (b) the cases where this is a breaking change are uncommon and unlikely to have been reliable anyway - it feels like a change we should make now.

Fixes #3283.

Changes to these two properties won't be handled correctly, so disallow them.
Ensure that transformations are processed early in resource construction
so that invariants established in the resource constructor cannot be
violated by changes made in transformations.  This ensures that transformations
can only express the same things that user parameters passed to the `Resource`
constructor are able to make.
// modifying it here would only even partially take affect). It's theoretically
// possible this restriction could be lifted in the future, but for now just
// disallow re-parenting resources in transformations to be safe.
throw new Error("Transformations cannot currently be used to change the `parent` of a resource.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for this. 👍

@lukehoban lukehoban merged commit 893e51d into master Oct 15, 2019
@pulumi-bot pulumi-bot deleted the lukehoban/transformations_python branch October 15, 2019 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add transformations to Python
2 participants