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 defining extra resources and functions #625

Merged
merged 1 commit into from Oct 26, 2022
Merged

Conversation

justinvp
Copy link
Member

Similar to the existing ExtraTypes field, add ExtraResources and ExtraFunctions fields to ProviderInfo to support defining extra schema for additional resources and functions. These could be for overlays or additional resources and/or functions implemented in a "multiplexed" provider.

Similar to the existing `ExtraTypes` field, add `ExtraResources` and `ExtraFunctions` fields to `ProviderInfo` to support defining extra schema for additional resources and functions. These could be for overlays or additional resources and/or functions implemented in a "multiplexed" provider.
Comment on lines +76 to +77
ExtraResources map[string]pschema.ResourceSpec // a map of Pulumi token to schema type for extra resources.
ExtraFunctions map[string]pschema.FunctionSpec // a map of Pulumi token to schema type for extra functions.
Copy link
Member Author

Choose a reason for hiding this comment

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

ExtraResources and ExtraFunctions are the only additions here.

Comment on lines +309 to +322
for token, res := range g.info.ExtraResources {
if _, defined := spec.Resources[token]; defined {
return pschema.PackageSpec{}, fmt.Errorf("failed to define extra resources: %v is already defined", token)
}
spec.Resources[token] = res
}

for token, fun := range g.info.ExtraFunctions {
if _, defined := spec.Functions[token]; defined {
return pschema.PackageSpec{}, fmt.Errorf("failed to define extra functions: %v is already defined", token)
}
spec.Functions[token] = fun
}

Copy link
Member Author

Choose a reason for hiding this comment

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

These loops are equivalent to the loop above on line 302 for ExtraTypes.

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 222736f

@github-actions
Copy link

Diff for pulumi-random with merge commit 222736f

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 222736f

@github-actions
Copy link

Diff for pulumi-azure with merge commit 222736f

@github-actions
Copy link

Diff for pulumi-aws with merge commit 222736f

Copy link
Contributor

@guineveresaenger guineveresaenger left a comment

Choose a reason for hiding this comment

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

Got some time to try this out, and it works beautifully as expected.

Thank you!

@justinvp justinvp merged commit e57f5c8 into master Oct 26, 2022
@justinvp justinvp deleted the justin/extras branch October 26, 2022 23:57
@guineveresaenger guineveresaenger added this to the 0.81 milestone Nov 28, 2022
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.

None yet

2 participants