Switching to a simpler ARM Template (#13043)

This commit is contained in:
Tom Harvey 2017-03-24 16:34:40 +00:00 committed by Paul Stack
parent d5f81f8022
commit 68e32c165c
1 changed files with 44 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import (
func TestAccAzureRMTemplateDeployment_basic(t *testing.T) {
ri := acctest.RandInt()
config := fmt.Sprintf(testAccAzureRMTemplateDeployment_basicExample, ri, ri)
config := fmt.Sprintf(testAccAzureRMTemplateDeployment_basicMultiple, ri, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
@ -31,7 +31,7 @@ func TestAccAzureRMTemplateDeployment_basic(t *testing.T) {
func TestAccAzureRMTemplateDeployment_disappears(t *testing.T) {
ri := acctest.RandInt()
config := fmt.Sprintf(testAccAzureRMTemplateDeployment_basicExample, ri, ri)
config := fmt.Sprintf(testAccAzureRMTemplateDeployment_basicSingle, ri, ri, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
@ -163,7 +163,47 @@ func testCheckAzureRMTemplateDeploymentDestroy(s *terraform.State) error {
return nil
}
var testAccAzureRMTemplateDeployment_basicExample = `
var testAccAzureRMTemplateDeployment_basicSingle = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
}
resource "azurerm_template_deployment" "test" {
name = "acctesttemplate-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
template_body = <<DEPLOY
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {
"location": "[resourceGroup().location]",
"publicIPAddressType": "Dynamic",
"apiVersion": "2015-06-15",
"dnsLabelPrefix": "[concat('terraform-tdacctest', uniquestring(resourceGroup().id))]"
},
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "[variables('apiVersion')]",
"name": "acctestpip-%d",
"location": "[variables('location')]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[variables('dnsLabelPrefix')]"
}
}
}
]
}
DEPLOY
deployment_mode = "Complete"
}
`
var testAccAzureRMTemplateDeployment_basicMultiple = `
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "West US"
@ -196,7 +236,7 @@ var testAccAzureRMTemplateDeployment_basicExample = `
"publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]",
"publicIPAddressType": "Dynamic",
"apiVersion": "2015-06-15",
"dnsLabelPrefix": "terraform-tdacctest"
"dnsLabelPrefix": "[concat('terraform-tdacctest', uniquestring(resourceGroup().id))]"
},
"resources": [
{