What is Pulumi
Pulumi is a multi-language and multi-cloud development platform. It lets you create all aspects of cloud programs using real languages and real code, from infrastructure on up to the application itself. Just write programs and run them, and Pulumi figures out the rest.
-
Install Pulumi https://www.pulumi.com/docs/get-started/install/
-
Install Azure CLI https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
Using Azure Blob for saving pulumi states
- Updating your configuration such resource group and etc.
vim launch.config
source launch.config
- Create a Azure Blob Container using launchpad
./launch.sh storage
- Export Azure variables (Azure backend requires setting the environment variables AZURE_STORAGE_ACCOUNT and either AZURE_STORAGE_KEY)
az storage account keys list -g $AZURE_RESOURCEGROUP -n $AZURE_STORAGE_ACCOUNT
export AZURE_STORAGE_KEY=<storage key>
- Login with Pulumi to Azure Storage
pulumi login --cloud-url azblob://statescontainer
This repo contains code of using Pulumi to build and deploy cloud applications and infrastructure based on this Cloud Native architecture
- Initialiase stack
cd src
pulumi stack init dev
- Create Python venv and install dependencies:
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
- Setting Azure Location
pulumi config set azure:environment public
pulumi config set azure:location SoutheastAsia
- Setting Variables
pulumi config set resource-group-name chatapps-rg
pulumi config set website-name chatappswebsite
pulumi config set zone-name app.com
pulumi config set pip-name chatapps-pip
pulumi config set --path 'vnet.name' chatapps-vnet
pulumi config set --path 'vnet.cidr' 10.0.0.0/16
pulumi config set --path 'vnet.subnet_frontend_cidr' 10.0.0.0/27
pulumi config set --path 'vnet.subnet_backend_cidr' 10.0.1.0/27
pulumi config set waf-name chatapps-waf
pulumi config set signalr-name chatapps-signalr
pulumi config set la-name chatapps-la
pulumi config set --path 'apim.name' chatapps-apim
pulumi config set --path 'apim.publisher_name' app-developer
pulumi config set --path 'apim.publisher_email' chat@app.com
pulumi config set cost-center 882233
- Let’s go ahead and deploy the stack
pulumi up
Resources provisioned by Pulumi
- Cleanup
pulumi destroy
pulumi stack rm dev
- To create Azure Function
- To deploy APIM inside VNET
- To configure API endpoint, access policies, developer portal, and etc.
- Landing Zone - Refactor module into multi-stack