The following is example code from the Pulumi site that demonstrates Pulumi automation in C# for a simple AWS deployment. The last line of code shows how a region can be configured for a workspace.
Is the equivalent available when deploying Azure resources? I ask because I am hoping to avoid assigning an Azure location to each resource and instead specify the location globally within the workspace.
FYI In this context I believe a workspace is a Pulumi automation artifact.
var stackArgs = new InlineProgramArgs(projectName, stackName, program);
var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
await stack.Workspace.InstallPluginAsync("aws", "v4.0.0");
// set stack configuration specifying the region to deploy
await stack.SetConfigAsync("aws:region", new ConfigValue("us-west-2"));
Yes, so the equivalent for the Pulumi Azure Native provider would be something like this:
var stackArgs = new InlineProgramArgs(projectName, stackName, program);
var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
await stack.Workspace.InstallPluginAsync("azure-native", "v1.14.0");
// set stack configuration specifying the region to deploy
await stack.SetConfigAsync("azure-native:location", new ConfigValue("uswest"));
So you'd swap the aws
for azure-native
, get the right version (the latest is v1.14.0 at the time of writing) and instead of region you'd have location.