github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-disk-example/main.tf (about)

     1  # ---------------------------------------------------------------------------------------------------------------------
     2  # DEPLOY AN AZURE MANAGED DISK
     3  # This is an example of how to deploy a managed disk.
     4  # ---------------------------------------------------------------------------------------------------------------------
     5  # See test/azure/terraform_azure_disk_example_test.go for how to write automated tests for this code.
     6  # ---------------------------------------------------------------------------------------------------------------------
     7  
     8  provider "azurerm" {
     9    version = "~> 2.29"
    10    features {}
    11  }
    12  
    13  terraform {
    14    # This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
    15    # 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
    16    # forwards compatible with 0.13.x code.
    17    required_version = ">= 0.12.26"
    18  }
    19  
    20  # ---------------------------------------------------------------------------------------------------------------------
    21  # DEPLOY A RESOURCE GROUP
    22  # ---------------------------------------------------------------------------------------------------------------------
    23  
    24  resource "azurerm_resource_group" "disk_rg" {
    25    name     = "terratest-disk-rg-${var.postfix}"
    26    location = var.location
    27  }
    28  
    29  # ---------------------------------------------------------------------------------------------------------------------
    30  # DEPLOY THE DISK
    31  # ---------------------------------------------------------------------------------------------------------------------
    32  
    33  resource "azurerm_managed_disk" "disk" {
    34    name                 = "disk-${var.postfix}"
    35    location             = azurerm_resource_group.disk_rg.location
    36    resource_group_name  = azurerm_resource_group.disk_rg.name
    37    storage_account_type = var.disk_type
    38    create_option        = "Empty"
    39    disk_size_gb         = 10
    40  }