Uploaded updated sample for HashiCorp article (#135)
This commit is contained in:
44
quickstart/101-storage-account-with-static-website/main.tf
Normal file
44
quickstart/101-storage-account-with-static-website/main.tf
Normal file
@ -0,0 +1,44 @@
|
||||
data "azurerm_client_config" "current" {}
|
||||
|
||||
# Generate random resource group name
|
||||
resource "random_pet" "rg_name" {
|
||||
prefix = var.resource_group_name_prefix
|
||||
}
|
||||
|
||||
resource "azurerm_resource_group" "rg" {
|
||||
location = var.resource_group_location
|
||||
name = random_pet.rg_name.id
|
||||
}
|
||||
|
||||
# Generate random value for the storage account name
|
||||
resource "random_string" "storage_account_name" {
|
||||
length = 8
|
||||
lower = true
|
||||
numeric = false
|
||||
special = false
|
||||
upper = false
|
||||
}
|
||||
|
||||
resource "azurerm_storage_account" "storage_account" {
|
||||
resource_group_name = azurerm_resource_group.rg.name
|
||||
location = azurerm_resource_group.rg.location
|
||||
|
||||
name = random_string.storage_account_name.result
|
||||
|
||||
account_tier = "Standard"
|
||||
account_replication_type = "LRS"
|
||||
account_kind = "StorageV2"
|
||||
|
||||
static_website {
|
||||
index_document = "index.html"
|
||||
}
|
||||
}
|
||||
|
||||
resource "azurerm_storage_blob" "example" {
|
||||
name = "index.html"
|
||||
storage_account_name = azurerm_storage_account.storage_account.name
|
||||
storage_container_name = "$web"
|
||||
type = "Block"
|
||||
content_type = "text/html"
|
||||
source = "index.html"
|
||||
}
|
Reference in New Issue
Block a user