pulumi / pulumi-terraform-bridge

A library allowing providers built with the Terraform Plugin SDK to be bridged into Pulumi.
Apache License 2.0
183 stars 41 forks source link

Custom package name in C# generated SDK #2064

Closed smartinellimarco closed 1 week ago

smartinellimarco commented 2 weeks ago

Hello!

Issue details

Is there a way to change the C# package name? Im thinking something like:

        CSharp: &tfbridge.CSharpInfo{
            RespectSchemaVersion: true,
            PackageReferences: map[string]string{
                "Pulumi": "3.*",
            },
            RootNamespace: nugetOrg,
                        PackageName: "MyPackage",
        },

Affected area/feature

C# SDK

guineveresaenger commented 2 weeks ago

Hi @smartinellimarco - thank you for filing this enhancement request. Can you tell us a bit more about your use case for this?

smartinellimarco commented 2 weeks ago

@guineveresaenger Hello! I bridged our terraform provider using the boilerplate at https://github.com/pulumi/pulumi-tf-provider-boilerplate. The tfgen tool uses as default the provider name for the package name. However this is customizable for the NPM and PyPi packages:

        JavaScript: &tfbridge.JavaScriptInfo{
            PackageName:          "@splightplatform/pulumi-splight",
            RespectSchemaVersion: true,
            Dependencies: map[string]string{
                "@pulumi/pulumi": "^3.0.0",
            },
            DevDependencies: map[string]string{
                "@types/node": "^10.0.0", // So we can access strongly typed node definitions.
                "@types/mime": "^2.0.0",
            },
        },
        Python: &tfbridge.PythonInfo{
            PackageName:          "pulumi_splight",
            RespectSchemaVersion: true,
            Requires: map[string]string{
                "pulumi": ">=3.0.0,<4.0.0",
            },
        },

But for NuGet, I can not find the same parameter, and given that our organization is called Splight, the package name ends up being Splight.Splight, which is not very descriptive.

guineveresaenger commented 2 weeks ago

Hi @smartinellimarco - I looked into it and I think that for C#, you'll be able to use the Namespaces map instead?

Namespaces: map[string]string{
  "splight": "awesomeNewPackage",
},

And, in the meantime, of course PRs are always welcome - we're happy to help. :)