Hi all, I am new to the infra as code and to Pulu...
# azure
Hi all, I am new to the infra as code and to Pulumi so please bear with me 🙂 I am probably making a really simple mistake but need guidance on (1) what is the better way here (2) what is the issue in my case. Here are the details; Project Name -> 'azure-project' At the root of this project I have initiated a azure python project and it has the files
'__main__.py', '.gitignore', 'Pulumi.<stack-name>.yaml', Pulumi.yaml' and requirement.txt file
then I have a folder named 'azure' and inside that folder I have a folder named 'storage' -- both have the files
in them. In my storage folder I have a
file that has the following content
Copy code
import pulumi
import pulumi_azure_native as azure_native

config = pulumi.Config()

location = config.require("azure-native:location")
resource_group_name = config.require("azure-project:resourceGroupName")
storage_account_name = config.require("azure-project:storageAccountName")

# Define a resource group
resource_group = azure_native.resources.ResourceGroup(
    "resource_group", resource_group_name=resource_group_name, location=location

# Create an Azure Storage Account using the name from the config
storage_account = azure_native.storage.StorageAccount(

# Export the connection string of the storage account
primary_connection_string = pulumi.Output.all(
    resource_group.name, storage_account.name
    lambda args: pulumi_azure_storage.get_storage_account_connection_string(
        resource_group_name=args[0], storage_account_name=args[1]

pulumi.export("primary_connection_string", primary_connection_string)
and my yaml file at the root level has the following content.
Copy code
  azure-native:location: "WestEurope"
  dost-azure-project:resourceGroupName: "pulumi-test-dev"
  dost-azure-project:storageAccountName: "pulumi-test-storage-account"
  dost-azure-project:registryName: "pulumi-test-acr"
Unfortunately, I am getting this error ' error: Missing required configuration variable 'azure-projectazure nativelocation' To me it seems that my main.py file in the azure/storage folder is not getting the config values from the .yaml file Basically, what I want to do is to have a structure where I can have e.g. 'storage', 'containerregistry', 'serviceplan', 'database' etc. as module inside a folder called 'azure' using python Any help/guidance in this regard will be really helpful.
is another "config bag" so you'd have to get config values like so:
Copy code
azure_config = pulumi.Config("azure-native")
location = azure_config.require("location")
Well that is pretty interesting @adventurous-butcher-54166 is there any documentation/reference about this? Thanks btw I will try this
It's a bit hidden but can be found here: https://www.pulumi.com/docs/concepts/config/#code Another thing I'd recommend especially if you have access to multiple Azure tenants & subscriptions is pinning those as well – otherwise deployment will happen in the subscription selected via azcli (
az account set --subscription <subscription_name>
Copy code
azure-native:location: westeurope
azure-native:subscriptionId: <your subscription guid>
azure-native:tenantId: <your tenant guid>
Then in code I always do:
Copy code
I've seen cases where some resources have been deployed in a correct subscription and then in a later pulumi deployment new resources would be deployed to a wrong subscription so that's why I have this as a working rule.
awesome! Thank you @adventurous-butcher-54166 I will look into this.