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
feat: Add support for language specific settings for resources #14308
Conversation
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
Changelog[uncommitted] (2023-11-29)Features
|
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
The docs generator has an issue where the panic: fatal: An assertion has failed: duplicate file: router/bgp/_index.md
goroutine 1 [running]:
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)
/home/vagrant/code/pulumi/sdk/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Assertf(0x30?, {0x1ae9498?, 0xc00d629530?}, {0xc000bcf040?, 0x48797e?, 0x1a24940?})
/home/vagrant/code/pulumi/sdk/go/common/util/contract/assert.go:35 +0xed
github.com/pulumi/pulumi/pkg/v3/codegen.Fs.Add(...)
/home/vagrant/code/pulumi/pkg/codegen/utilities.go:180
github.com/pulumi/pulumi/pkg/v3/codegen/docs.(*modContext).gen.func1({0x0, 0x0}, {0x1adb5af, 0xa}, {0x1a24940, 0xc00e3303c0})
/home/vagrant/code/pulumi/pkg/codegen/docs/gen.go:1854 +0x225
github.com/pulumi/pulumi/pkg/v3/codegen/docs.(*modContext).gen(0xc000bf2aa0, 0xc000bede00)
/home/vagrant/code/pulumi/pkg/codegen/docs/gen.go:1962 +0x11db
github.com/pulumi/pulumi/pkg/v3/codegen/docs.(*docGenContext).generatePackage(0xc0000c1400, {0x0?, 0x0?}, 0x0?)
/home/vagrant/code/pulumi/pkg/codegen/docs/gen.go:2201 +0x2e8
github.com/pulumi/pulumi/pkg/v3/codegen/docs.GeneratePackage(...)
/home/vagrant/code/pulumi/pkg/codegen/docs/gen.go:2255
github.com/pulumi/registrygen/pkg.generateDocsFromSchema({0x7ffeb02ae50a, 0xf}, 0xc4a256?)
/home/vagrant/code/pulumi-registrygen/pkg/docs.go:218 +0x54
github.com/pulumi/registrygen/pkg.GenerateDocs({0x7ffeb02ae493?, 0x0?}, {0x7ffeb02ae4b8, 0x6}, {0x7ffeb02ae4cc, 0x30}, {0x7ffeb02ae50a, 0xf}, {0x7ffeb02ae532, 0xb}, ...)
/home/vagrant/code/pulumi-registrygen/pkg/docs.go:111 +0x896
github.com/pulumi/registrygen/cmd/docs.PackageDocsCmd.func1(0xc0007ff800?, {0x1ad0743?, 0x9?, 0x9?})
/home/vagrant/code/pulumi-registrygen/cmd/docs/cli.go:89 +0x74
github.com/spf13/cobra.(*Command).execute(0xc0007ff800, {0xc0006943f0, 0x9, 0x9})
/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc0007fe600)
/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(0xc000124120?)
/home/vagrant/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x19
main.main()
/home/vagrant/code/pulumi-registrygen/main.go:30 +0x8b I think the |
So I had some time to further analyze the above shown Example: Module: The |
/run-acceptance-tests |
I'll let the platform team pipe in but the bar for making changes to Pulumi package schema is very high I think. Is this needed or useful for non-bridged providers? If not can we fix it in the bridge please? The tokens are free form already and the bridge can assign them. There are hidden costs to extra degrees of freedom here, such as breaking |
@t0yv0 Since I'm really working on the core of Pulumi, the hurdles are probably so high that no one will be willing to accept the changes. Nevertheless, I think it's helpful, if not say required, to have the possibility to define the name of a class/object differently as defined by the default name if you have to deeply nest namespaces inside an SDK of a provider to make the SDK easy to use and approachable. Right now even huge Pulumi providers like AWS and Azure put resources into namespaces one level deep. Now I know why: because structuring namespaces with more levels, causes errors while creating the SDK items itself or the documentation. As you can see by the panic I posted and my respective analysis. To make it clear, the panic has nothing to do with the changes I introduced in the PR. It's another bug inside the codegen packge in Pulumi. Regarding you question if this could be handled isolated in the Bridge: I don't think so, because as with the Aside that I could reproduce the error that failed the acceptance tests locally. Reason is that I must implement a custom Marshaler/Unmarshaler for YAML and the cc: @iwahbe |
This is true, we're actually on an internal hold for all codegen related work right now so the chance of this getting accepted soon is virtually nil.
Personally I'd like to remove all these features from the schema but we're not doing that anytime soon. Given we support overrides in most places for most languages its at least consistent to support this as well.
Yes, it's not a well tested path. I don't know if all our providers went with non-nested namespaces because it was too buggy to do nesting or if they had other reasons and so we never invested in supporting nested namespaces.
Agreed. Being a csharp codegen change it won't be possible to fix bridge side.
That surprises me. The other schema objects with language fields don't need this? |
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
/run-acceptance-tests |
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
/run-acceptance-tests |
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a careful look over this seems low risk and unblocks a tfbridge fix, so ✅
Looks like a lint issue in one test file: |
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
…tings for ResourceSpec
…pdated ImportResourceSpec to unmarshal raw data
…ceInfo in resourceName
…rpResourceInfo in resourceTypeName
…-for-language-specific-settings-for-resources-and-support-for-overriding-resource-name-in-dotnet-codegen.yaml
…kenToName to ensure type rename via CSharpResourceInfo is applied
…on struct ResourceSpec because it is already defined by the composite ObjectTypeSpec
…es because the messages are compared literally in acceptance tests.
acac2e3
to
90c6e64
Compare
PR is now waiting for a maintainer to take action. Note for the maintainer: Commands available:
|
@Frassle I couldn't really make any sense of the error message, but a rebase to the master branch led to a collision. I resolved this first and updated the branch. Perhaps the error has now disappeared. CC @iwahbe Would be great if someone could approve the waiting workflows. 😀 Oh and of course another approval is required because I changed the branch by pushing. |
This PR implements the missing part for PR pulumi/pulumi#14308 from the Pulumi SDK to have the ability to rename the generated C# (dotnet) class from it's provider resource name. This PR comes with an update of `github.com/pulumi/pulumi/pkg/v3` and `github.com/pulumi/pulumi/sdk/v3` to at v3.95.0 because this is the first version of Pulumi which implements the required code for the `dotnet` codegen to emit a renamed class using the `CSharpName` property. --------- Co-authored-by: Thomas Meckel <tmeckel@users.noreply.github.com> Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
Description
This PR contains changes to support language specific settings for resources. This PR is a prerequisite to resolve a corresponding bug in the Terraform Bridge.
Fixes pulumi/pulumi-terraform-bridge#1460
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change