github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/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 template_body = <<DEPLOY 25 { 26 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 27 "contentVersion": "1.0.0.0", 28 "parameters": { 29 "storageAccountType": { 30 "type": "string", 31 "defaultValue": "Standard_LRS", 32 "allowedValues": [ 33 "Standard_LRS", 34 "Standard_GRS", 35 "Standard_ZRS" 36 ], 37 "metadata": { 38 "description": "Storage Account type" 39 } 40 } 41 }, 42 "variables": { 43 "location": "[resourceGroup().location]", 44 "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]", 45 "publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]", 46 "publicIPAddressType": "Dynamic", 47 "apiVersion": "2015-06-15", 48 "dnsLabelPrefix": "terraform-acctest" 49 }, 50 "resources": [ 51 { 52 "type": "Microsoft.Storage/storageAccounts", 53 "name": "[variables('storageAccountName')]", 54 "apiVersion": "[variables('apiVersion')]", 55 "location": "[variables('location')]", 56 "properties": { 57 "accountType": "[parameters('storageAccountType')]" 58 } 59 }, 60 { 61 "type": "Microsoft.Network/publicIPAddresses", 62 "apiVersion": "[variables('apiVersion')]", 63 "name": "[variables('publicIPAddressName')]", 64 "location": "[variables('location')]", 65 "properties": { 66 "publicIPAllocationMethod": "[variables('publicIPAddressType')]", 67 "dnsSettings": { 68 "domainNameLabel": "[variables('dnsLabelPrefix')]" 69 } 70 } 71 } 72 ] 73 } 74 DEPLOY 75 deployment_mode = "Complete" 76 } 77 ``` 78 79 ## Argument Reference 80 81 The following arguments are supported: 82 83 * `name` - (Required) Specifies the name of the template deployment. Changing this forces a 84 new resource to be created. 85 * `resource_group_name` - (Required) The name of the resource group in which to 86 create the template deployment. 87 * `deployment_mode` - (Required) Specifies the mode that is used to deploy resources. This value could be either `Incremental` or `Complete`. 88 Note that you will almost *always* want this to be set to `Incremental` otherwise the deployment will destroy all infrastructure not 89 specified within the template, and Terraform will not be aware of this. 90 * `template_body` - (Optional) Specifies the JSON definition for the template. 91 * `parameters` - (Optional) Specifies the name and value pairs that define the deployment parameters for the template. 92 93 94 ## Attributes Reference 95 96 The following attributes are exported: 97 98 * `id` - The Template Deployment ID.