Azure Storage Static Website
This Terraform module provides the required infrastructure to host a static website on Azure Storage.
Uploads the files in the specified local directory to the $web
container in the specified storage account.
Creates a CDN endpoint for the storage account.
Adds a custom domain, via DNS CNAME record, to the CDN endpoint.
Adds a CDN managed certificate to the custom domain.
module "static_website" {
source = " github.com/messeb/terraform-az-static-website"
resource_group_name = " az-static-website"
resources_base_name = " az-static-website"
location = " westeurope"
referer_check_file_extensions = [" css" , " jpeg" , " jpg" , " gif" , " js" , " png" , " svg" , " webp" , " zip" ]
index_file = " index.html"
error_file = " 404.html"
web_folder = " public"
sub_domain_dns = {
resource_group_name = " example-dns-rg"
zone_name = " example.com"
root_domain = " example.com"
sub_domain_name = " az-static-website"
}
}
Name
Description
Type
Default
Required
resource_group_name
Resource group in which the resources will be created.
string
n/a
yes
resources_base_name
Basename for all of the resources.
string
n/a
yes
location
Azure cloud region
string
n/a
yes
referer_check_file_extensions
List of file extension for which a "referer" header is checked
list(string)
[]
no
index_file
Index page of the website
string
"index.html"
no
error_file
404 error page of the website
string
"404.html"
no
sub_domain_dns.resource_group_name
Resource group of the DNS zone of the root domain
string
n/a
yes
zone_name
Zone name of the root domain
string
n/a
yes
root_domain
Root domain of the website
string
n/a
yes
sub_domain_name
Sub-domain of the website
string
n/a
yes
Name
Description
website_url
The HTTPS-URL of the statice website.