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

Support stack transformations #478

Closed
Tracked by #598
t0yv0 opened this issue Apr 26, 2022 · 5 comments · Fixed by #677
Closed
Tracked by #598

Support stack transformations #478

t0yv0 opened this issue Apr 26, 2022 · 5 comments · Fixed by #677
Assignees
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Milestone

Comments

@t0yv0
Copy link
Member

t0yv0 commented Apr 26, 2022

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

This is a feature supported in other language SDKs but missing from the Java SDK.

https://www.pulumi.com/docs/intro/concepts/resources/options/transformations/#stack-transformations

Affected area/feature

@t0yv0 t0yv0 added the kind/enhancement Improvements or new features label Apr 26, 2022
@pawelprazak
Copy link
Contributor

API probably would look like this:

ctx.registerStackTransformation(Function<ResourceTransformationArgs, ResourceTransformationResult>)

@pawelprazak
Copy link
Contributor

Looks like we have this, but was hidden with the Stack class
Screenshot 2022-04-29 at 18 28 20

@pawelprazak
Copy link
Contributor

I've had a look at it, but I did too many refactorings. I think we need to do #488 first.

@pawelprazak
Copy link
Contributor

After consulting with @t0yv0 we'll get back to it after preview.

@pawelprazak pawelprazak mentioned this issue May 24, 2022
40 tasks
@mikhailshilkov mikhailshilkov added this to the 0.73 milestone May 24, 2022
@mikhailshilkov mikhailshilkov modified the milestones: 0.73, 0.74 May 31, 2022
@pawelprazak
Copy link
Contributor

pawelprazak commented Jun 1, 2022

Unfortunately, setting transformations on the context (like in Go) is not possible with the current implementation of Resource.

Since Stack inherits Resource initialization logic, the transformations are registered in the constructor.
Also the Stack needs to exist before any user code is executed (including setting the transformations on the context).

Alternative APIs:

dotnet inspired (very easy to implement)

Pulumi.run(ctx -> { ... }, StackOptions.builder().transformations(...).build())

or a "fluent" approach (new public interface will be required for the withStackTransformations to have something to return

Pulumi
    .withOptions(StackOptions.builder().transformations(...).build())
    .run(ctx -> {...})

I personally don't have strong preference (slight preference for the second one, since it is consistent with what I plan for PulumiTest and PulumiAuto APIs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants