Uploaded updated sample for HashiCorp article (#135)
This commit is contained in:
parent
aa014f1118
commit
dd30e9384e
@ -0,0 +1,2 @@
|
||||
# build_local_module
|
||||
A module to deploy basic Azure resources
|
@ -0,0 +1 @@
|
||||
<h1> This is a static website example <h1>
|
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"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
output "resource_group_name" {
|
||||
value = azurerm_resource_group.rg.name
|
||||
}
|
||||
|
||||
output "storage_account_name" {
|
||||
value = azurerm_storage_account.storage_account.name
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
terraform {
|
||||
required_version = ">=1.0"
|
||||
|
||||
required_providers {
|
||||
azurerm = {
|
||||
source = "hashicorp/azurerm"
|
||||
version = "~>3.0"
|
||||
}
|
||||
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
version = "~>3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
variable "resource_group_location" {
|
||||
default = "eastus"
|
||||
description = "Location of the resource group."
|
||||
}
|
||||
|
||||
variable "resource_group_name_prefix" {
|
||||
default = "rg"
|
||||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user