chilly-dream-30512
09/15/2024, 12:40 PMfunc (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)
}
...
chilly-dream-30512
09/15/2024, 12:47 PM//go:embed dummy.sh.tmpl
var dummyTemplate string
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by