github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/azurerm/r/template_deployment.html.markdown (about) 1 --- 2 layout: "azurerm" 3 page_title: "Azure Resource Manager: azurerm_template_deployment" 4 sidebar_current: "docs-azurerm-resource-template-deployment" 5 description: |- 6 Create a template deployment of resources. 7 --- 8 9 # azurerm\_template\_deployment 10 11 Create a template deployment of resources 12 13 ## Example Usage 14 15 ``` 16 resource "azurerm_resource_group" "test" { 17 name = "acctestrg-01" 18 location = "West US" 19 } 20 21 resource "azurerm_template_deployment" "test" { 22 name = "acctesttemplate-01" 23 resource_group_name = "${azurerm_resource_group.test.name}" 24 25 template_body = <<DEPLOY 26 { 27 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 28 "contentVersion": "1.0.0.0", 29 "parameters": { 30 "storageAccountType": { 31 "type": "string", 32 "defaultValue": "Standard_LRS", 33 "allowedValues": [ 34 "Standard_LRS", 35 "Standard_GRS", 36 "Standard_ZRS" 37 ], 38 "metadata": { 39 "description": "Storage Account type" 40 } 41 } 42 }, 43 "variables": { 44 "location": "[resourceGroup().location]", 45 "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]", 46 "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]", 47 "publicIPAddressType": "Dynamic", 48 "apiVersion": "2015-06-15", 49 "dnsLabelPrefix": "terraform-acctest" 50 }, 51 "resources": [ 52 { 53 "type": "Microsoft.Storage/storageAccounts", 54 "name": "[variables('storageAccountName')]", 55 "apiVersion": "[variables('apiVersion')]", 56 "location": "[variables('location')]", 57 "properties": { 58 "accountType": "[parameters('storageAccountType')]" 59 } 60 }, 61 { 62 "type": "Microsoft.Network/publicIPAddresses", 63 "apiVersion": "[variables('apiVersion')]", 64 "name": "[variables('publicIPAddressName')]", 65 "location": "[variables('location')]", 66 "properties": { 67 "publicIPAllocationMethod": "[variables('publicIPAddressType')]", 68 "dnsSettings": { 69 "domainNameLabel": "[variables('dnsLabelPrefix')]" 70 } 71 } 72 } 73 ] 74 } 75 DEPLOY 76 77 deployment_mode = "Complete" 78 } 79 ``` 80 81 ## Argument Reference 82 83 The following arguments are supported: 84 85 * `name` - (Required) Specifies the name of the template deployment. Changing this forces a 86 new resource to be created. 87 * `resource_group_name` - (Required) The name of the resource group in which to 88 create the template deployment. 89 * `deployment_mode` - (Required) Specifies the mode that is used to deploy resources. This value could be either `Incremental` or `Complete`. 90 Note that you will almost *always* want this to be set to `Incremental` otherwise the deployment will destroy all infrastructure not 91 specified within the template, and Terraform will not be aware of this. 92 * `template_body` - (Optional) Specifies the JSON definition for the template. 93 * `parameters` - (Optional) Specifies the name and value pairs that define the deployment parameters for the template. 94 95 96 ## Attributes Reference 97 98 The following attributes are exported: 99 100 * `id` - The Template Deployment ID.