What’s the correct way to set a custom secrets pro...
# automation-api
b
What’s the correct way to set a custom secrets provider without having to specify it in each stack’s manifest file? For example, the following (abbreviated) code:
Copy code
opts := []auto.LocalWorkspaceOption{
	...
	auto.SecretsProvider("awskms://..."),
}

stack, err := auto.UpsertStackLocalSource(ctx, "dev", "example", opts...)
if err != nil {
	log.Fatalf("Failed to load dev stack: %s\n", err)
}

_, err = stack.Refresh(ctx, optrefresh.ProgressStreams(os.Stdout))
if err != nil {
	log.Fatalf("Failed to refresh dev stack: %s\n", err)
}
Results in the following error:
Copy code
[...] passphrase must be set with PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE environment variables [...]
The answer is to pass a list of stack configs (with
auto.Stacks
) to the
opts
🤦‍♂️
Copy code
auto.Stacks(map[string]workspace.ProjectStack{
	"dev": {
		SecretsProvider: "awskms://...",
	},
}),
The examples in https://github.com/pulumi/automation-api-examples actually cover this. I just missed it completely the first time I’ve looked at them