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

Unable to use ClientConfiguration from Secrets as an input #90

Closed
scottslowe opened this issue Mar 18, 2024 · 1 comment · Fixed by #91
Closed

Unable to use ClientConfiguration from Secrets as an input #90

scottslowe opened this issue Mar 18, 2024 · 1 comment · Fixed by #91
Assignees

Comments

@scottslowe
Copy link

For Go, it looks like #69 changed machine.NewSecrets to machine.NewSecretsType. (This makes the Go examples incorrect, by the way.) However, it doesn't seem to work as expected.

Let's say talosSecrets represents the result of a machine.NewSecretsType call. We'd then need to use this result (or portions of it) in a number of other places:

  • We'd need to use the MachineSecrets portion in a machine.GetConfigurationOutput call. This works via talosSecrets.ToSecretTypeOutput().MachineSecrets().
  • We'd also need to use the ClientConfiguration portion in both machine.NewConfigurationApply and machine.NewBootstrap calls. This does not work using talosSecrets.ToSecretTypeOutput.ClientConfiguration() (incorrect type/type mismatch reported by the IDE and running pulumi preview or pulumi up fails with a go build error).

Ultimately, this means that the provider appears to be broken/non-functional for Go (I have not tested/checked in other languages).

Here is the error received when running pulumi preview or pulumi up:

    # github.com/pulumiverse/pulumi-talos/sdk/go/talos/machine
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:49:6: SecretsType redeclared in this block
    	../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3190:6: other declaration of SecretsType
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:69:75: cannot use &resource (value of type *SecretsType) as pulumi.Resource value in argument to ctx.RegisterResource: *SecretsType does not implement pulumi.Resource (missing method URN)
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:117:6: SecretsTypeArgs redeclared in this block
    	../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3209:6: other declaration of SecretsTypeArgs
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:122:24: method SecretsTypeArgs.ElementType already declared at ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3216:24
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:126:6: SecretsTypeInput redeclared in this block
    	../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3201:6: other declaration of SecretsTypeInput
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:195:6: SecretsTypeOutput redeclared in this block
    	../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3270:6: other declaration of SecretsTypeOutput
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:197:26: method SecretsTypeOutput.ElementType already declared at ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3272:26
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:201:28: method SecretsTypeOutput.ToSecretsTypeOutput already declared at ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3276:28
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:205:28: method SecretsTypeOutput.ToSecretsTypeOutputWithContext already declared at ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/pulumiTypes.go:3280:28
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/init.go:29:7: cannot use &SecretsType{} (value of type *SecretsType) as pulumi.Resource value in assignment: *SecretsType does not implement pulumi.Resource (missing method URN)
    ../../Go/pkg/mod/github.com/pulumiverse/pulumi-talos/[email protected]/go/talos/machine/secrets.go:69:75: too many errors

    error: error in compiling Go: unable to run `go build`: exit status 1
@ringods ringods self-assigned this Mar 19, 2024
@ringods
Copy link
Member

ringods commented Mar 19, 2024

@scottslowe there are two Go types named SecretsType in the same module:

type SecretsType struct {
pulumi.CustomResourceState
// The generated client configuration data
ClientConfiguration SecretsClientConfigurationOutput `pulumi:"clientConfiguration"`
// The secrets for the talos cluster
MachineSecrets MachineSecretsOutput `pulumi:"machineSecrets"`
// The version of talos features to use in generated machine configuration
TalosVersion pulumi.StringOutput `pulumi:"talosVersion"`
}

type SecretsType struct {
// The bootstrap token for the talos kubernetes cluster
Bootstrap_token string `pulumi:"bootstrap_token"`
// The secretbox encryption secret for the talos kubernetes cluster
Secretbox_encryption_secret string `pulumi:"secretbox_encryption_secret"`
}

I will have to change the mapping from TF data structures into Pulumi types as there are way to many items either named "machine" or "secrets" in the upstream Talos provider.

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 a pull request may close this issue.

2 participants