I am creating pulumi provider and would like it to...
# general
c
I am creating pulumi provider and would like it to upload a shell script in the provider package but it seems when built nodejs version doesn’t have the file available. Does anyone know of strategies for referencing files in a provider? My provider is based on the provider template project. https://github.com/pulumi/pulumi-provider-boilerplate
Copy code
func (Validator) Create(ctx context.Context, name string, input ValidatorArgs, preview bool) (string, ValidatorState, error) {
	state := ValidatorState{ValidatorArgs: input}

	if preview {
		return name, state, nil
	}

	// Load the template file
	tmpl, err := template.ParseFiles("templates/validator/dummy.sh.tmpl")
	if err != nil {
		return "", ValidatorState{}, fmt.Errorf("failed to parse template: %w", err)
	}

	// Create a buffer to store the executed template
	var scriptBuffer bytes.Buffer
	err = tmpl.Execute(&scriptBuffer, input)
	if err != nil {
		return "", ValidatorState{}, fmt.Errorf("failed to execute template: %w", err)
	}
...
Trying out embed package
Copy code
//go:embed dummy.sh.tmpl
var dummyTemplate string