https://pulumi.com logo
#dotnet
Title
# dotnet
o

orange-airplane-72526

12/05/2022, 2:48 PM
Hi, whats the best way to set an s3 backend when using the c# pulumi automation API. Ex.:
Copy code
var program = PulumiFn.Create<MyStack>();

var stackArgs = new InlineProgramArgs("test", "a", program);

var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
await stack.SetConfigAsync("aws:region", new ConfigValue("eu-central-1"));
await stack.UpAsync();
e

echoing-dinner-19531

12/06/2022, 8:46 AM
I don't think there's anything in automation api to change backends. The main approach is to just make sure the ambient login is correct, but I think you can set the Pulumi.yaml for inline programs explicitly and set the backend there (see the ProjectSettings.Backend option)
o

orange-airplane-72526

12/06/2022, 10:44 AM
Thanks for the info. I'd like to use the s3 backend but am still confused how authentication would be handled when using the Pulumi.yml file?
I think you can set the Pulumi.yaml for inline programs explicitly
do you maybe have an example or docs how to do that?
e

echoing-dinner-19531

12/06/2022, 1:54 PM
ProjectSettings is the class with the backend property to set. You then set the workspace settings with the new project settings. And the workspace settings are what you pass to things like
CreateStackAsync
authentication would be handled
Auth is always done using ambient environment variables for the s3 backend.
o

orange-airplane-72526

12/06/2022, 2:03 PM
thats exactly what I was looking for! Thanks!