https://pulumi.com logo
#golang
Title
# golang
h

happy-football-3560

07/29/2022, 7:51 PM
Hi, I'm trying to input a s3 path into a Databricks cluster initscript but am having trouble with the nested syntax to provide it. https://www.pulumi.com/registry/packages/databricks/api-docs/cluster/#clusterinitscripts3 One odd bit that I see is the link from InitScripts to the ClusterInitScriptArgs lists []ClusterInitScriptArgs as the type but the link takes me to an entry named ClusterInitScript. Does this mean that I need to be doing
ClusterInitScript: { S3: {
? (also I'm very new to Pulumi - I feel like I might be missing something obvious)
Copy code
_, err := databricks.NewCluster(ctx, "my-cluster", &databricks.ClusterArgs{
  InitScripts: []databricks.ClusterInitScriptArgs{
    {
      S3: &databricks.ClusterInitScriptS3{
        Destination: "<s3://path/to/script.sh>",
      },
    },
  },
}
@bored-table-20691
b

billowy-army-68599

07/30/2022, 4:33 AM
@happy-football-3560 this should work. It compiles correctly. It really helps using intellisense in vscode to build these
Copy code
package main

import (
	"fmt"
	"<http://github.com/pulumi/pulumi-databricks/sdk/go/databricks|github.com/pulumi/pulumi-databricks/sdk/go/databricks>"
	"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {

		cluster, err := databricks.NewCluster(ctx, "example", &databricks.ClusterArgs{
			InitScripts: databricks.ClusterInitScriptArray{
				databricks.ClusterInitScriptArgs{
					S3: databricks.ClusterInitScriptS3Args{
						Destination: pulumi.String("something"),
					},
				},
			},
		})

		if err != nil {
			return fmt.Errorf("error creating cluster: %w", err)
		}

		ctx.Export("clusterName", cluster.ClusterName)

		return nil

	})
}
i haven’t tested it
h

happy-football-3560

08/01/2022, 4:11 AM
Hey! I arrived at this answer too - how do I get intellisense working? I will have to work on that some. Definitely found this one challenging to do.
6 Views