https://pulumi.com logo
#general
Title
# general
p

prehistoric-sandwich-7272

02/21/2023, 5:44 PM
Hi Guys My Pulumi Packages journey continues 🙂 I have created a pulumi packages repo, and components written in Go The component gets a structure like this:
Copy code
// GcpPermissionsArgs The set of arguments for creating a GcpPermissions component resource.
type GcpPermissionsArgs struct {
   Project               string   `pulumi:"project"`
   GcpServiceAccountName string   `pulumi:"gcpServiceAccountName"`
   GcpPermissions        []string `pulumi:"gcpPermissions"`
}
GcpPermissions
is an array of strings ([]string). The packages is generating the Typescript code, making the args as follows:
Copy code
/**
 * The set of arguments for constructing a GcpPermissions resource.
 */
export interface GcpPermissionsArgs {
    /**
     * Array of GCP permissions.
     */
    gcpPermissions: pulumi.Input<pulumi.Input<{
        [key: string]: pulumi.Input<string>;
    }>[]>;
    /**
     * Wanted name for the new service account.
     */
    gcpServiceAccountName: pulumi.Input<string>;
    /**
     * Pulumi project's name.
     */
    project: pulumi.Input<string>;
}
Making the
gcpPermissions
argument be an array of key value variables. Actual result should have been something like:
Copy code
gcpPermissions: pulumi.Input<string>[];
What am I doing wrong? how can I solve this?
b

billowy-army-68599

02/21/2023, 6:01 PM
@prehistoric-sandwich-7272 you’d need to make the input type on the struct, an Input<string> see here as an example: https://github.com/jaxxstorm/pulumi-productionapp/blob/main/provider/pkg/provider/productionApp.go#L29
for your specific type, it would
pulumi.StringArrayInput
p

prehistoric-sandwich-7272

02/22/2023, 8:25 AM
Thanks!!
4 Views