Azure Storage Account | Terraform
In these Hands-On Storage Account is created and that storage account Blob storage is created and index.html file is uploaded

Pre-requisites -
Azure Account Terraform Azure CLI


main.tf
provider "azurerm" {
features {}
}
# Create a resource group
resource "azurerm_resource_group" "resource_group" {
name = "rg-terraform-demo"
location = "eastus"
}
# Create a Storage Account
resource "azurerm_storage_account" "storage_account" {
name = "terraformazuretoronto"
resource_group_name = azurerm_resource_group.resource_group.name
location = azurerm_resource_group.resource_group.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
static_website {
index_document = "index.html"
}
}
# Add an index.html file
resource "azurerm_storage_blob" "index_blob" {
name = "index.html"
storage_account_name = azurerm_storage_account.storage_account.name
storage_container_name = "$web"
type = "Block"
content_type = "text/html"
source_content = <<-EOT
<h1> Ahoy, This is a Bhushan Website Using Terraform </h1>
EOT
}


Terraform init

terraform validate
terraform plan

terraform apply


OUTPUT -




TERRAFORM DESTROY


Last updated