modern-branch-92818
04/26/2022, 11:18 PMimport * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const config = new pulumi.Config();
const location = config.require("location");
const storageAccountName = config.require("storageAccountName");
const storageContainerName = config.require("storageContainerName");
const resourceGroupName = config.require("resourceGroupName");
const storage = azure.core.getResourceGroup({
name: resourceGroupName,
location: location,
});
const container = new azure.storage.Container("container", {
name: storageContainerName,
storageAccountName: storageAccountName,
containerAccessType: "private",
});
export const containerId = container.id;
export const containerResourceId = container.resourceManagerId;
This typescript code snippet was generated using tf2pulumi and I"m confuse about two things:
• How do I add provider configuration to this to tell Pulumi which subscription I want to deploy the resource to?
• How do I add backend configuraiton to this to tell Pulumi which backend I want to store my state file in (which in this case should be an Azure storage account)
I've read through the documentation and can't seem to find the answer to these questions, any assistance would be greatly appreciatedminiature-musician-31262
04/26/2022, 11:54 PMpulumi stack init
— let me see if I can find the best doc for thatmodern-branch-92818
04/27/2022, 12:02 AMnew azure.Provider
construct, I think that answers my question regarding the provider configurationminiature-musician-31262
04/27/2022, 12:02 AMpulumi login
for the backendmodern-branch-92818
04/27/2022, 12:04 AMpulumi login
is the cli tool to use for configuring the backend but can this not be defined inline?miniature-musician-31262
04/27/2022, 12:05 AMmodern-branch-92818
04/27/2022, 12:05 AMpulumi login
on the directory, so what's the usual expectation of how you initialise the pulumi backend for an unattended, inline function like thatminiature-musician-31262
04/27/2022, 12:11 AMpulumi login
— you’d just run it as part of your application startup. So for example, if your app were running as a Node.js process on an Azure VM, and your startup script were something like node index.js
, you’d just add a line before that node
call to run pulumi login azblob://...
first, and Automation API (running in your application) would use that as its configured backend.modern-branch-92818
04/27/2022, 12:28 AMPULUMI_BACKEND_URL
environment variable, so for Azure blob you set that to azblob://mycontainer and seet the AZURE_STORAGE_ACCOUNT
and AZURE_STORAGE_KEY
environment variables for the automation API to pick up on?miniature-musician-31262
04/27/2022, 1:07 PM