github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-storage-example/main.tf (about) 1 # --------------------------------------------------------------------------------------------------------------------- 2 # DEPLOY A STORAGE ACCOUNT SET 3 # This is an example of how to deploy a Storage Account. 4 # --------------------------------------------------------------------------------------------------------------------- 5 # See test/azure/terraform_azure_storage_example_test.go for how to write automated tests for this code. 6 # --------------------------------------------------------------------------------------------------------------------- 7 8 provider "azurerm" { 9 version = "~> 2.20" 10 features {} 11 } 12 13 # PIN TERRAFORM VERSION 14 15 terraform { 16 # This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting 17 # 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it 18 # forwards compatible with 0.13.x code. 19 required_version = ">= 0.12.26" 20 } 21 22 # --------------------------------------------------------------------------------------------------------------------- 23 # DEPLOY A RESOURCE GROUP 24 # --------------------------------------------------------------------------------------------------------------------- 25 26 resource "azurerm_resource_group" "resource_group" { 27 name = "terratest-storage-rg-${var.postfix}" 28 location = var.location 29 } 30 31 # --------------------------------------------------------------------------------------------------------------------- 32 # DEPLOY A STORAGE ACCOUNT 33 # --------------------------------------------------------------------------------------------------------------------- 34 35 resource "azurerm_storage_account" "storage_account" { 36 name = "storage${var.postfix}" 37 resource_group_name = azurerm_resource_group.resource_group.name 38 location = azurerm_resource_group.resource_group.location 39 account_kind = var.storage_account_kind 40 account_tier = var.storage_account_tier 41 account_replication_type = var.storage_replication_type 42 } 43 44 # --------------------------------------------------------------------------------------------------------------------- 45 # ADD A CONTAINER TO THE STORAGE ACCOUNT 46 # --------------------------------------------------------------------------------------------------------------------- 47 48 resource "azurerm_storage_container" "container" { 49 name = "container1" 50 storage_account_name = azurerm_storage_account.storage_account.name 51 container_access_type = var.container_access_type 52 } 53