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 recursive resource type definitions in components #94

Open
EvanBoyle opened this issue Jun 13, 2023 · 1 comment
Open

Support recursive resource type definitions in components #94

EvanBoyle opened this issue Jun 13, 2023 · 1 comment
Labels
kind/enhancement Improvements or new features

Comments

@EvanBoyle
Copy link

Maybe this is already supported? I couldn't figure out how to do it.

I have some component resource code I'm trying to port from a typescript component into a go MLC with pulumi-go-provider:

https://github.com/pulumi/pulumi-auto-deploy-old/blob/main/index.ts#L61-L76

I have a component resource AutoDeployer with input property downstream (the recursive reference). downstream is an array of AutoDeployer.

From within the component, I want to read input properties on the downstream AutoDeploy resources that get passed in and create other resources from those inputs.

export const b = new AutoDeployer("auto-deployer-b", {
    org,
    project,
    stack: "b",
    downstream: [d, e, f],

Since I could not figure out the appropriate types and pulumi struct tags, I had to change the type of downstream to be an array of stringInput which is unfortunately not as type-safe:

export const b = new AutoDeployer("auto-deployer-b", {
    org,
    project,
    stack: "b",
    downstream: [d.stackRef, e.stackRef, f.stackRef],
});
@AaronFriel AaronFriel added the kind/enhancement Improvements or new features label Jun 13, 2023
@AaronFriel
Copy link
Member

Per internal conversation, this is likely blocked on supporting Go generics:

This is because the particular type of recursive type desired is a list of AutoDeployer instances.

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
Projects
None yet
Development

No branches or pull requests

2 participants