- Built using the following resources
- Install Pulumi
- Configure Pulumi to Use Azure If your Azure CLI is configured, no further changes are required.
-
Initialize a new stack called
dev
via pulumi stack init.pulumi stack init dev
-
Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
az login
-
Create a Python virtualenv, activate it, and install dependencies:
This installs the dependent packages for our Pulumi program.
python3 -m venv venv source venv/bin/activate pip3 install -r requirements.txt
-
Set the confi values via pulumi config set.
Here are Azure regions see this infographic for a list of available regions)
pulumi config set azure-native:location eastus2 pulumi config set mynames demo pulumi config set virtual_network_cidr 10.0.0.0/22 pulumi config set subnet_1_cidr 10.0.0.0/23 pulumi config set subnet_2_cidr 10.0.2.0/23
-
Run
pulumi up
to preview and deploy changes: You must selecty
to continuepulumi up
Results
Previewing update (dev) View Live: https://app.pulumi.com/myuser/azure-py-vnet/dev/previews/e31a02c1-c98e-4147-a0df-ebdd14e7f473 Type Name Plan + pulumi:pulumi:Stack azure-py-vnet-dev create + ├─ azure-native:resources:ResourceGroup peering-to-databricks-resource_group create + ├─ azure-native:network:VirtualNetwork peering-to-databricks-vnet create + ├─ azure-native:network:Subnet peering-to-databricks-subnet1 create + └─ azure-native:network:Subnet peering-to-databricks-subnet2 create Resources: + 5 to create Do you want to perform this update? [Use arrows to move, enter to select, type to filter] yes > no details
-
Select yes and the resources are created along with outputs
Updating (dev) View Live: https://app.pulumi.com/myuser/azure-py-vnet/dev/updates/9 Type Name Status + pulumi:pulumi:Stack azure-py-vnet-dev created + ├─ azure-native:resources:ResourceGroup peering-to-databricks-resource_group created + ├─ azure-native:network:VirtualNetwork peering-to-databricks-vnet created + ├─ azure-native:network:Subnet peering-to-databricks-subnet2 created + └─ azure-native:network:Subnet peering-to-databricks-subnet1 created Outputs: resourcegroup_name : "peering-to-databricks-resource_group07399224" vnet_cidr_block : { address_prefixes: [ [0]: "10.0.0.0/22" ] } vnet_name : "peering-to-databricks-vnet3ba0db3a" vnet_subnet1_cidr_block: "10.0.0.0/23" vnet_subnet1_cidr_name : "peering-to-databricks-subnet1" vnet_subnet2_cidr_block: "10.0.2.0/23" vnet_subnet2_cidr_name : "peering-to-databricks-subnet2" Resources: + 5 created Duration: 17s
-
View the outputs created via pulumi stack output
pulumi stack output
Results
Current stack outputs (7): OUTPUT VALUE resourcegroup_name peering-to-databricks-resource_group07399224 vnet_cidr_block {"address_prefixes":["10.0.0.0/22"]} vnet_name peering-to-databricks-vnet3ba0db3a vnet_subnet1_cidr_block 10.0.0.0/23 vnet_subnet1_cidr_name peering-to-databricks-subnet1 vnet_subnet2_cidr_block 10.0.2.0/23 vnet_subnet2_cidr_name peering-to-databricks-subnet2
-
Grab the StackReference for this stack. The StackReference constructor takes as input a string of the form //, and lets you access the outputs of that stack. Since we are building a vnet with subnets, we want to use it in another stack.
pulumi stack output
Results
Current stack is dev: Owner: myuser Last updated: 3 minutes ago (2021-06-24 08:45:03.946094 -0400 EDT) Pulumi version: v3.5.1 Current stack resources (6): TYPE NAME pulumi:pulumi:Stack azure-py-vnet-dev ├─ azure-native:resources:ResourceGroup peering-to-databricks-resource_group ├─ azure-native:network:VirtualNetwork peering-to-databricks-vnet ├─ azure-native:network:Subnet peering-to-databricks-subnet2 ├─ azure-native:network:Subnet peering-to-databricks-subnet1 └─ pulumi:providers:azure-native default_1_14_0 Current stack outputs (7): OUTPUT VALUE resourcegroup_name peering-to-databricks-resource_group07399224 vnet_cidr_block {"address_prefixes":["10.0.0.0/22"]} vnet_name peering-to-databricks-vnet3ba0db3a vnet_subnet1_cidr_block 10.0.0.0/23 vnet_subnet1_cidr_name peering-to-databricks-subnet1 vnet_subnet2_cidr_block 10.0.2.0/23 vnet_subnet2_cidr_name peering-to-databricks-subnet2 More information at: https://app.pulumi.com/myuser/azure-py-vnet/dev
What we want is this: myuser/azure-py-vnet/dev
-
Destroy the network and subnet. Make sure all your
OTHER
stacks that depend on this network have their resources all deletedBEFORE
you clean up any networking resources.pulumi destroy -y
-
Remove the stack
pulumi stack rm dev