provider/azurerm: Fix azurerm_template_deployment

Tests are too slow to run.
This commit is contained in:
James Nugent 2016-06-01 19:32:25 -05:00
parent 8ecfddf507
commit 0691c0eb91
3 changed files with 470 additions and 461 deletions

View File

@ -60,7 +60,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_storage_container": resourceArmStorageContainer(), "azurerm_storage_container": resourceArmStorageContainer(),
"azurerm_storage_queue": resourceArmStorageQueue(), "azurerm_storage_queue": resourceArmStorageQueue(),
"azurerm_subnet": resourceArmSubnet(), "azurerm_subnet": resourceArmSubnet(),
//"azurerm_template_deployment": resourceArmTemplateDeployment(), "azurerm_template_deployment": resourceArmTemplateDeployment(),
//"azurerm_virtual_machine": resourceArmVirtualMachine(), //"azurerm_virtual_machine": resourceArmVirtualMachine(),
"azurerm_virtual_network": resourceArmVirtualNetwork(), "azurerm_virtual_network": resourceArmVirtualNetwork(),

View File

@ -1,213 +1,222 @@
package azurerm package azurerm
//import ( import (
// "encoding/json" "encoding/json"
// "fmt" "fmt"
// "log" "log"
// "net/http" "net/http"
// "strings" "strings"
// "time" "time"
//
// "github.com/Azure/azure-sdk-for-go/arm/resources/resources" "github.com/Azure/azure-sdk-for-go/arm/resources/resources"
// "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
// "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
//) )
//
//func resourceArmTemplateDeployment() *schema.Resource { func resourceArmTemplateDeployment() *schema.Resource {
// return &schema.Resource{ return &schema.Resource{
// Create: resourceArmTemplateDeploymentCreate, Create: resourceArmTemplateDeploymentCreate,
// Read: resourceArmTemplateDeploymentRead, Read: resourceArmTemplateDeploymentRead,
// Update: resourceArmTemplateDeploymentCreate, Update: resourceArmTemplateDeploymentCreate,
// Delete: resourceArmTemplateDeploymentDelete, Delete: resourceArmTemplateDeploymentDelete,
//
// Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
// "name": &schema.Schema{ "name": {
// Type: schema.TypeString, Type: schema.TypeString,
// Required: true, Required: true,
// ForceNew: true, ForceNew: true,
// }, },
//
// "resource_group_name": &schema.Schema{ "resource_group_name": {
// Type: schema.TypeString, Type: schema.TypeString,
// Required: true, Required: true,
// ForceNew: true, ForceNew: true,
// }, },
//
// "template_body": &schema.Schema{ "template_body": {
// Type: schema.TypeString, Type: schema.TypeString,
// Optional: true, Optional: true,
// Computed: true, Computed: true,
// StateFunc: normalizeJson, StateFunc: normalizeJson,
// }, },
//
// "parameters": &schema.Schema{ "parameters": {
// Type: schema.TypeMap, Type: schema.TypeMap,
// Optional: true, Optional: true,
// }, },
//
// "outputs": &schema.Schema{ "outputs": {
// Type: schema.TypeMap, Type: schema.TypeMap,
// Computed: true, Computed: true,
// }, },
//
// "deployment_mode": &schema.Schema{ "deployment_mode": {
// Type: schema.TypeString, Type: schema.TypeString,
// Required: true, Required: true,
// }, },
// }, },
// } }
//} }
//
//func resourceArmTemplateDeploymentCreate(d *schema.ResourceData, meta interface{}) error { func resourceArmTemplateDeploymentCreate(d *schema.ResourceData, meta interface{}) error {
// client := meta.(*ArmClient) client := meta.(*ArmClient)
// deployClient := client.deploymentsClient deployClient := client.deploymentsClient
//
// name := d.Get("name").(string) name := d.Get("name").(string)
// resGroup := d.Get("resource_group_name").(string) resGroup := d.Get("resource_group_name").(string)
// deploymentMode := d.Get("deployment_mode").(string) deploymentMode := d.Get("deployment_mode").(string)
//
// log.Printf("[INFO] preparing arguments for Azure ARM Template Deployment creation.") log.Printf("[INFO] preparing arguments for Azure ARM Template Deployment creation.")
// properties := resources.DeploymentProperties{ properties := resources.DeploymentProperties{
// Mode: resources.DeploymentMode(deploymentMode), Mode: resources.DeploymentMode(deploymentMode),
// } }
//
// if v, ok := d.GetOk("parameters"); ok { if v, ok := d.GetOk("parameters"); ok {
// params := v.(map[string]interface{}) params := v.(map[string]interface{})
//
// newParams := make(map[string]interface{}, len(params)) newParams := make(map[string]interface{}, len(params))
// for key, val := range params { for key, val := range params {
// newParams[key] = struct { newParams[key] = struct {
// Value interface{} Value interface{}
// }{ }{
// Value: val, Value: val,
// } }
// } }
//
// properties.Parameters = &newParams properties.Parameters = &newParams
// } }
//
// if v, ok := d.GetOk("template_body"); ok { if v, ok := d.GetOk("template_body"); ok {
// template, err := expandTemplateBody(v.(string)) template, err := expandTemplateBody(v.(string))
// if err != nil { if err != nil {
// return err return err
// } }
//
// properties.Template = &template properties.Template = &template
// } }
//
// deployment := resources.Deployment{ deployment := resources.Deployment{
// Properties: &properties, Properties: &properties,
// } }
// resp, err := deployClient.CreateOrUpdate(resGroup, name, deployment)
// if err != nil { _, err := deployClient.CreateOrUpdate(resGroup, name, deployment, make(chan struct{}))
// return nil if err != nil {
// } return nil
// }
// d.SetId(*resp.ID)
// read, err := deployClient.Get(resGroup, name)
// log.Printf("[DEBUG] Waiting for Template Deployment (%s) to become available", name) if err != nil {
// stateConf := &resource.StateChangeConf{ return err
// Pending: []string{"creating", "updating", "accepted", "running"}, }
// Target: []string{"succeeded"}, if read.ID == nil {
// Refresh: templateDeploymentStateRefreshFunc(client, resGroup, name), return fmt.Errorf("Cannot read Template Deployment %s (resource group %s) ID", name, resGroup)
// Timeout: 40 * time.Minute, }
// }
// if _, err := stateConf.WaitForState(); err != nil { d.SetId(*read.ID)
// return fmt.Errorf("Error waiting for Template Deployment (%s) to become available: %s", name, err)
// } log.Printf("[DEBUG] Waiting for Template Deployment (%s) to become available", name)
// stateConf := &resource.StateChangeConf{
// return resourceArmTemplateDeploymentRead(d, meta) Pending: []string{"creating", "updating", "accepted", "running"},
//} Target: []string{"succeeded"},
// Refresh: templateDeploymentStateRefreshFunc(client, resGroup, name),
//func resourceArmTemplateDeploymentRead(d *schema.ResourceData, meta interface{}) error { Timeout: 40 * time.Minute,
// client := meta.(*ArmClient) }
// deployClient := client.deploymentsClient if _, err := stateConf.WaitForState(); err != nil {
// return fmt.Errorf("Error waiting for Template Deployment (%s) to become available: %s", name, err)
// id, err := parseAzureResourceID(d.Id()) }
// if err != nil {
// return err return resourceArmTemplateDeploymentRead(d, meta)
// } }
// resGroup := id.ResourceGroup
// name := id.Path["deployments"] func resourceArmTemplateDeploymentRead(d *schema.ResourceData, meta interface{}) error {
// if name == "" { client := meta.(*ArmClient)
// name = id.Path["Deployments"] deployClient := client.deploymentsClient
// }
// id, err := parseAzureResourceID(d.Id())
// resp, err := deployClient.Get(resGroup, name) if err != nil {
// if resp.StatusCode == http.StatusNotFound { return err
// d.SetId("") }
// return nil resGroup := id.ResourceGroup
// } name := id.Path["deployments"]
// if err != nil { if name == "" {
// return fmt.Errorf("Error making Read request on Azure RM Template Deployment %s: %s", name, err) name = id.Path["Deployments"]
// } }
// var outputs map[string]string
// if resp.Properties.Outputs != nil && len(*resp.Properties.Outputs) > 0 { resp, err := deployClient.Get(resGroup, name)
// outputs = make(map[string]string) if resp.StatusCode == http.StatusNotFound {
// for key, output := range *resp.Properties.Outputs { d.SetId("")
// outputMap := output.(map[string]interface{}) return nil
// outputValue, ok := outputMap["value"] }
// if !ok { if err != nil {
// // No value return fmt.Errorf("Error making Read request on Azure RM Template Deployment %s: %s", name, err)
// continue }
// } var outputs map[string]string
// if resp.Properties.Outputs != nil && len(*resp.Properties.Outputs) > 0 {
// outputs[key] = outputValue.(string) outputs = make(map[string]string)
// } for key, output := range *resp.Properties.Outputs {
// } outputMap := output.(map[string]interface{})
// outputValue, ok := outputMap["value"]
// d.Set("outputs", outputs) if !ok {
// // No value
// return nil continue
//} }
//
//func resourceArmTemplateDeploymentDelete(d *schema.ResourceData, meta interface{}) error { outputs[key] = outputValue.(string)
// client := meta.(*ArmClient) }
// deployClient := client.deploymentsClient }
//
// id, err := parseAzureResourceID(d.Id()) d.Set("outputs", outputs)
// if err != nil {
// return err return nil
// } }
// resGroup := id.ResourceGroup
// name := id.Path["deployments"] func resourceArmTemplateDeploymentDelete(d *schema.ResourceData, meta interface{}) error {
// if name == "" { client := meta.(*ArmClient)
// name = id.Path["Deployments"] deployClient := client.deploymentsClient
// }
// id, err := parseAzureResourceID(d.Id())
// _, err = deployClient.Delete(resGroup, name) if err != nil {
// return nil return err
//} }
// resGroup := id.ResourceGroup
//func expandTemplateBody(template string) (map[string]interface{}, error) { name := id.Path["deployments"]
// var templateBody map[string]interface{} if name == "" {
// err := json.Unmarshal([]byte(template), &templateBody) name = id.Path["Deployments"]
// if err != nil { }
// return nil, fmt.Errorf("Error Expanding the template_body for Azure RM Template Deployment")
// } _, err = deployClient.Delete(resGroup, name, make(chan struct{}))
// return templateBody, nil return nil
//} }
//
//func normalizeJson(jsonString interface{}) string { func expandTemplateBody(template string) (map[string]interface{}, error) {
// if jsonString == nil || jsonString == "" { var templateBody map[string]interface{}
// return "" err := json.Unmarshal([]byte(template), &templateBody)
// } if err != nil {
// var j interface{} return nil, fmt.Errorf("Error Expanding the template_body for Azure RM Template Deployment")
// err := json.Unmarshal([]byte(jsonString.(string)), &j) }
// if err != nil { return templateBody, nil
// return fmt.Sprintf("Error parsing JSON: %s", err) }
// }
// b, _ := json.Marshal(j) func normalizeJson(jsonString interface{}) string {
// return string(b[:]) if jsonString == nil || jsonString == "" {
//} return ""
// }
//func templateDeploymentStateRefreshFunc(client *ArmClient, resourceGroupName string, name string) resource.StateRefreshFunc { var j interface{}
// return func() (interface{}, string, error) { err := json.Unmarshal([]byte(jsonString.(string)), &j)
// res, err := client.deploymentsClient.Get(resourceGroupName, name) if err != nil {
// if err != nil { return fmt.Sprintf("Error parsing JSON: %s", err)
// return nil, "", fmt.Errorf("Error issuing read request in templateDeploymentStateRefreshFunc to Azure ARM for Template Deployment '%s' (RG: '%s'): %s", name, resourceGroupName, err) }
// } b, _ := json.Marshal(j)
// return string(b[:])
// return res, strings.ToLower(*res.Properties.ProvisioningState), nil }
// }
//} func templateDeploymentStateRefreshFunc(client *ArmClient, resourceGroupName string, name string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
res, err := client.deploymentsClient.Get(resourceGroupName, name)
if err != nil {
return nil, "", fmt.Errorf("Error issuing read request in templateDeploymentStateRefreshFunc to Azure ARM for Template Deployment '%s' (RG: '%s'): %s", name, resourceGroupName, err)
}
return res, strings.ToLower(*res.Properties.ProvisioningState), nil
}
}

View File

@ -1,251 +1,251 @@
package azurerm package azurerm
//import ( import (
// "fmt" "fmt"
// "net/http" "net/http"
// "testing" "testing"
//
// "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/acctest"
// "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
// "github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
//) )
//
//func TestAccAzureRMTemplateDeployment_basic(t *testing.T) { func TestAccAzureRMTemplateDeployment_basic(t *testing.T) {
// ri := acctest.RandInt() ri := acctest.RandInt()
// config := fmt.Sprintf(testAccAzureRMTemplateDeployment_basicExample, ri, ri) config := fmt.Sprintf(testAccAzureRMTemplateDeployment_basicExample, ri, ri)
// resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
// PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
// Providers: testAccProviders, Providers: testAccProviders,
// CheckDestroy: testCheckAzureRMTemplateDeploymentDestroy, CheckDestroy: testCheckAzureRMTemplateDeploymentDestroy,
// Steps: []resource.TestStep{ Steps: []resource.TestStep{
// resource.TestStep{ {
// Config: config, Config: config,
// Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
// testCheckAzureRMTemplateDeploymentExists("azurerm_template_deployment.test"), testCheckAzureRMTemplateDeploymentExists("azurerm_template_deployment.test"),
// ), ),
// }, },
// }, },
// }) })
//} }
//
//func TestAccAzureRMTemplateDeployment_withParams(t *testing.T) { func TestAccAzureRMTemplateDeployment_withParams(t *testing.T) {
// ri := acctest.RandInt() ri := acctest.RandInt()
// config := fmt.Sprintf(testAccAzureRMTemplateDeployment_withParams, ri, ri, ri) config := fmt.Sprintf(testAccAzureRMTemplateDeployment_withParams, ri, ri, ri)
// resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
// PreCheck: func() { testAccPreCheck(t) }, PreCheck: func() { testAccPreCheck(t) },
// Providers: testAccProviders, Providers: testAccProviders,
// CheckDestroy: testCheckAzureRMTemplateDeploymentDestroy, CheckDestroy: testCheckAzureRMTemplateDeploymentDestroy,
// Steps: []resource.TestStep{ Steps: []resource.TestStep{
// resource.TestStep{ {
// Config: config, Config: config,
// Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
// testCheckAzureRMTemplateDeploymentExists("azurerm_template_deployment.test"), testCheckAzureRMTemplateDeploymentExists("azurerm_template_deployment.test"),
// resource.TestCheckResourceAttr("azurerm_template_deployment.test", "outputs.testOutput", "Output Value"), resource.TestCheckResourceAttr("azurerm_template_deployment.test", "outputs.testOutput", "Output Value"),
// ), ),
// }, },
// }, },
// }) })
//} }
//
//func testCheckAzureRMTemplateDeploymentExists(name string) resource.TestCheckFunc { func testCheckAzureRMTemplateDeploymentExists(name string) resource.TestCheckFunc {
// return func(s *terraform.State) error { return func(s *terraform.State) error {
// // Ensure we have enough information in state to look up in API // Ensure we have enough information in state to look up in API
// rs, ok := s.RootModule().Resources[name] rs, ok := s.RootModule().Resources[name]
// if !ok { if !ok {
// return fmt.Errorf("Not found: %s", name) return fmt.Errorf("Not found: %s", name)
// } }
//
// name := rs.Primary.Attributes["name"] name := rs.Primary.Attributes["name"]
// resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"] resourceGroup, hasResourceGroup := rs.Primary.Attributes["resource_group_name"]
// if !hasResourceGroup { if !hasResourceGroup {
// return fmt.Errorf("Bad: no resource group found in state for template deployment: %s", name) return fmt.Errorf("Bad: no resource group found in state for template deployment: %s", name)
// } }
//
// conn := testAccProvider.Meta().(*ArmClient).deploymentsClient conn := testAccProvider.Meta().(*ArmClient).deploymentsClient
//
// resp, err := conn.Get(resourceGroup, name) resp, err := conn.Get(resourceGroup, name)
// if err != nil { if err != nil {
// return fmt.Errorf("Bad: Get on deploymentsClient: %s", err) return fmt.Errorf("Bad: Get on deploymentsClient: %s", err)
// } }
//
// if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {
// return fmt.Errorf("Bad: TemplateDeployment %q (resource group: %q) does not exist", name, resourceGroup) return fmt.Errorf("Bad: TemplateDeployment %q (resource group: %q) does not exist", name, resourceGroup)
// } }
//
// return nil return nil
// } }
//} }
//
//func testCheckAzureRMTemplateDeploymentDestroy(s *terraform.State) error { func testCheckAzureRMTemplateDeploymentDestroy(s *terraform.State) error {
// conn := testAccProvider.Meta().(*ArmClient).vmClient conn := testAccProvider.Meta().(*ArmClient).vmClient
//
// for _, rs := range s.RootModule().Resources { for _, rs := range s.RootModule().Resources {
// if rs.Type != "azurerm_template_deployment" { if rs.Type != "azurerm_template_deployment" {
// continue continue
// } }
//
// name := rs.Primary.Attributes["name"] name := rs.Primary.Attributes["name"]
// resourceGroup := rs.Primary.Attributes["resource_group_name"] resourceGroup := rs.Primary.Attributes["resource_group_name"]
//
// resp, err := conn.Get(resourceGroup, name, "") resp, err := conn.Get(resourceGroup, name, "")
//
// if err != nil { if err != nil {
// return nil return nil
// } }
//
// if resp.StatusCode != http.StatusNotFound { if resp.StatusCode != http.StatusNotFound {
// return fmt.Errorf("Template Deployment still exists:\n%#v", resp.Properties) return fmt.Errorf("Template Deployment still exists:\n%#v", resp.Properties)
// } }
// } }
//
// return nil return nil
//} }
//
//var testAccAzureRMTemplateDeployment_basicExample = ` var testAccAzureRMTemplateDeployment_basicExample = `
// resource "azurerm_resource_group" "test" { resource "azurerm_resource_group" "test" {
// name = "acctestrg-%d" name = "acctestrg-%d"
// location = "West US" location = "West US"
// } }
//
// resource "azurerm_template_deployment" "test" { resource "azurerm_template_deployment" "test" {
// name = "acctesttemplate-%d" name = "acctesttemplate-%d"
// resource_group_name = "${azurerm_resource_group.test.name}" resource_group_name = "${azurerm_resource_group.test.name}"
// template_body = <<DEPLOY template_body = <<DEPLOY
//{ {
// "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
// "contentVersion": "1.0.0.0", "contentVersion": "1.0.0.0",
// "parameters": { "parameters": {
// "storageAccountType": { "storageAccountType": {
// "type": "string", "type": "string",
// "defaultValue": "Standard_LRS", "defaultValue": "Standard_LRS",
// "allowedValues": [ "allowedValues": [
// "Standard_LRS", "Standard_LRS",
// "Standard_GRS", "Standard_GRS",
// "Standard_ZRS" "Standard_ZRS"
// ], ],
// "metadata": { "metadata": {
// "description": "Storage Account type" "description": "Storage Account type"
// } }
// } }
// }, },
// "variables": { "variables": {
// "location": "[resourceGroup().location]", "location": "[resourceGroup().location]",
// "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]", "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]",
// "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]", "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]",
// "publicIPAddressType": "Dynamic", "publicIPAddressType": "Dynamic",
// "apiVersion": "2015-06-15", "apiVersion": "2015-06-15",
// "dnsLabelPrefix": "terraform-acctest" "dnsLabelPrefix": "terraform-acctest"
// }, },
// "resources": [ "resources": [
// { {
// "type": "Microsoft.Storage/storageAccounts", "type": "Microsoft.Storage/storageAccounts",
// "name": "[variables('storageAccountName')]", "name": "[variables('storageAccountName')]",
// "apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
// "location": "[variables('location')]", "location": "[variables('location')]",
// "properties": { "properties": {
// "accountType": "[parameters('storageAccountType')]" "accountType": "[parameters('storageAccountType')]"
// } }
// }, },
// { {
// "type": "Microsoft.Network/publicIPAddresses", "type": "Microsoft.Network/publicIPAddresses",
// "apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
// "name": "[variables('publicIPAddressName')]", "name": "[variables('publicIPAddressName')]",
// "location": "[variables('location')]", "location": "[variables('location')]",
// "properties": { "properties": {
// "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
// "dnsSettings": { "dnsSettings": {
// "domainNameLabel": "[variables('dnsLabelPrefix')]" "domainNameLabel": "[variables('dnsLabelPrefix')]"
// } }
// } }
// } }
// ] ]
//} }
//DEPLOY DEPLOY
// deployment_mode = "Complete" deployment_mode = "Complete"
// } }
//
//` `
//
//var testAccAzureRMTemplateDeployment_withParams = ` var testAccAzureRMTemplateDeployment_withParams = `
// resource "azurerm_resource_group" "test" { resource "azurerm_resource_group" "test" {
// name = "acctestrg-%d" name = "acctestrg-%d"
// location = "West US" location = "West US"
// } }
//
// output "test" { output "test" {
// value = "${azurerm_template_deployment.test.outputs.testOutput}" value = "${azurerm_template_deployment.test.outputs.testOutput}"
// } }
//
// resource "azurerm_template_deployment" "test" { resource "azurerm_template_deployment" "test" {
// name = "acctesttemplate-%d" name = "acctesttemplate-%d"
// resource_group_name = "${azurerm_resource_group.test.name}" resource_group_name = "${azurerm_resource_group.test.name}"
// template_body = <<DEPLOY template_body = <<DEPLOY
//{ {
// "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
// "contentVersion": "1.0.0.0", "contentVersion": "1.0.0.0",
// "parameters": { "parameters": {
// "storageAccountType": { "storageAccountType": {
// "type": "string", "type": "string",
// "defaultValue": "Standard_LRS", "defaultValue": "Standard_LRS",
// "allowedValues": [ "allowedValues": [
// "Standard_LRS", "Standard_LRS",
// "Standard_GRS", "Standard_GRS",
// "Standard_ZRS" "Standard_ZRS"
// ], ],
// "metadata": { "metadata": {
// "description": "Storage Account type" "description": "Storage Account type"
// } }
// }, },
// "dnsLabelPrefix": { "dnsLabelPrefix": {
// "type": "string", "type": "string",
// "metadata": { "metadata": {
// "description": "DNS Label for the Public IP. Must be lowercase. It should match with the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$ or it will raise an error." "description": "DNS Label for the Public IP. Must be lowercase. It should match with the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$ or it will raise an error."
// } }
// } }
// }, },
// "variables": { "variables": {
// "location": "[resourceGroup().location]", "location": "[resourceGroup().location]",
// "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]", "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]",
// "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]", "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]",
// "publicIPAddressType": "Dynamic", "publicIPAddressType": "Dynamic",
// "apiVersion": "2015-06-15" "apiVersion": "2015-06-15"
// }, },
// "resources": [ "resources": [
// { {
// "type": "Microsoft.Storage/storageAccounts", "type": "Microsoft.Storage/storageAccounts",
// "name": "[variables('storageAccountName')]", "name": "[variables('storageAccountName')]",
// "apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
// "location": "[variables('location')]", "location": "[variables('location')]",
// "properties": { "properties": {
// "accountType": "[parameters('storageAccountType')]" "accountType": "[parameters('storageAccountType')]"
// } }
// }, },
// { {
// "type": "Microsoft.Network/publicIPAddresses", "type": "Microsoft.Network/publicIPAddresses",
// "apiVersion": "[variables('apiVersion')]", "apiVersion": "[variables('apiVersion')]",
// "name": "[variables('publicIPAddressName')]", "name": "[variables('publicIPAddressName')]",
// "location": "[variables('location')]", "location": "[variables('location')]",
// "properties": { "properties": {
// "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
// "dnsSettings": { "dnsSettings": {
// "domainNameLabel": "[parameters('dnsLabelPrefix')]" "domainNameLabel": "[parameters('dnsLabelPrefix')]"
// } }
// } }
// } }
// ], ],
// "outputs": { "outputs": {
// "testOutput": { "testOutput": {
// "type": "string", "type": "string",
// "value": "Output Value" "value": "Output Value"
// } }
// } }
//} }
//DEPLOY DEPLOY
// parameters { parameters {
// dnsLabelPrefix = "terraform-test-%d" dnsLabelPrefix = "terraform-test-%d"
// storageAccountType = "Standard_GRS" storageAccountType = "Standard_GRS"
// } }
// deployment_mode = "Complete" deployment_mode = "Complete"
// } }
//
//` `