pulumi / pulumi-tls-self-signed-cert

Apache License 2.0
1 stars 2 forks source link

Error during `go build` when using the suggested example #7

Open siwei-luo opened 1 year ago

siwei-luo commented 1 year ago

What happened?

Given the Go sample:

cert, err := selfsignedcert.NewSelfSignedCertificate(ctx, "cert", &selfsignedcert.SelfSignedCertificateArgs{
            DnsName:                  pulumi.String("cert.example.com"),
            ValidityPeriodHours:      pulumi.Int(807660),
            LocalValidityPeriodHours: pulumi.Int(17520),
            Subject: tls.SelfSignedCertSubjectArgs{
                CommonName:   pulumi.String("example-cert"),
                Organization: pulumi.String("example-cert LLC"),
            },
        })
        if err != nil {
            return err
        }

I am getting following error after executing pulumi up:

    # github.com/pulumi/pulumi-tls-self-signed-cert/sdk/go/tls-self-signed-cert
    /home/sluo/.go/pkg/mod/github.com/pulumi/pulumi-tls-self-signed-cert/sdk@v0.1.3/go/tls-self-signed-cert/selfSignedCertificate.go:11:2: "github.com/pulumi/pulumi-tls/sdk/v4/go/tls" imported and not used
    /home/sluo/.go/pkg/mod/github.com/pulumi/pulumi-tls-self-signed-cert/sdk@v0.1.3/go/tls-self-signed-cert/selfSignedCertificate.go:106:10: undefined: SelfSignedCertSubject
    /home/sluo/.go/pkg/mod/github.com/pulumi/pulumi-tls-self-signed-cert/sdk@v0.1.3/go/tls-self-signed-cert/selfSignedCertificate.go:128:10: undefined: SelfSignedCertSubjectInput

    error: error in compiling Go: unable to run `go build`: exit status 1

This looks like a library issue here?

Expected Behavior

Successful creation of the requested self signed certificate.

Steps to reproduce

Run the minimal Go sample to create a self-signed certificate.

Output of pulumi about

CLI
Version 3.63.0 Go Version go1.20.2 Go Compiler gc Host
OS arch Version
Arch x86_64

Backend
Name pulumi.com URL https://app.pulumi.com/sluo User sluo Organizations sluo, flipapp

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

jooooel commented 7 months ago

I ran into this issue now as well. I would like to fix it, but I'm don't have any experience writing Pulumi packages. I assume I have to make some kind of changes to the schema.json file, but I'm unsure what.

The issue though is that this piece of generated code https://github.com/pulumi/pulumi-tls-self-signed-cert/blob/49b5cd362c6e9cb4de736341b107a1da1c3d69cf/sdk/go/tls-self-signed-cert/selfSignedCertificate.go#L106

...should generated as:

Subject tls.SelfSignedCertSubject `pulumi:"subject"` 

If anyone can help me in the right direction I can fix a PR

siwei-luo commented 7 months ago

@jooooel I ended up in working around the issue by using github.com/pulumi/pulumi-tls/sdk/v4/go/tls instead to create a self signed certificate:

https://www.pulumi.com/registry/packages/tls/api-docs/selfsignedcert/