Skip to main content

Host a Static Website on Azure Blob Storage, Written in HCL

A static website hosted on Azure Blob Storage, written in HCL

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set azure-hcl-static-website
cd pulumi-examples/azure-hcl-static-website

A static website served from Azure Blob Storage’s static website support, written in Pulumi HCL. Pulumi installs the HCL language plugin and the Terraform azurerm and random providers automatically the first time you run the program.

Deploying and running the program#

  1. Create a new stack:

    Terminal window
    pulumi stack init website-testing
  2. Configure your Azure credentials. The azurerm provider reads the standard ARM_* environment variables, and requires ARM_SUBSCRIPTION_ID to be set.

  3. (Optional) Set the Azure location to deploy into. It defaults to westus:

    Terminal window
    pulumi config set azure-hcl-static-website:location westus2
  4. Run pulumi up to preview and deploy changes. After the preview is shown you will be prompted if you want to continue or not.

  5. Open the site URL in a browser to see the rendered HTML:

    Terminal window
    pulumi stack output endpoint
    https://site***.z22.web.core.windows.net/
  6. To clean up resources, run pulumi destroy and answer the confirmation question at the prompt.

Related

The infrastructure as code platform for any cloud.