Azure Storage Static Website
![Overview](assets/overview.svg)
This Terraform module provides the required infrastructure to host a static website on Azure Storage.
![](https://camo.githubusercontent.com/ea3660c02c1612aa8dde96a1c26e5538a97025cff39d6720dc149cfc8ecb3d5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6d65737365622f7465727261666f726d2d617a2d7374617469632d77656273697465)
- 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. |