Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

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.

Prerequisites#

  1. Install Pulumi
  2. Configure Azure credentials. The azurerm provider reads the standard ARM_* environment variables, and requires ARM_SUBSCRIPTION_ID to be set.

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init website-testing
  2. (Optional) Set the Azure location to deploy into. It defaults to westus:

    Terminal window
    pulumi config set azure-hcl-static-website:location westus2
  3. Deploy the stack:

    Terminal window
    pulumi up
  4. 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/

Cleaning up#

Once you’re finished experimenting, you can destroy your stack and remove it to avoid incurring any additional cost:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.