Created
September 25, 2022 23:57
-
-
Save FernandoCutire/0c031f21689662273baae859c6063c0f to your computer and use it in GitHub Desktop.
Saved from https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/template_deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "azurerm_resource_group" "example" { | |
name = "example-resources" | |
location = "West Europe" | |
} | |
resource "azurerm_template_deployment" "example" { | |
name = "acctesttemplate-01" | |
resource_group_name = azurerm_resource_group.example.name | |
template_body = <<DEPLOY | |
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"storageAccountType": { | |
"type": "string", | |
"defaultValue": "Standard_LRS", | |
"allowedValues": [ | |
"Standard_LRS", | |
"Standard_GRS", | |
"Standard_ZRS" | |
], | |
"metadata": { | |
"description": "Storage Account type" | |
} | |
} | |
}, | |
"variables": { | |
"location": "[resourceGroup().location]", | |
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'storage')]", | |
"publicIPAddressName": "[concat('myPublicIp', uniquestring(resourceGroup().id))]", | |
"publicIPAddressType": "Dynamic", | |
"apiVersion": "2015-06-15", | |
"dnsLabelPrefix": "terraform-acctest" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"name": "[variables('storageAccountName')]", | |
"apiVersion": "[variables('apiVersion')]", | |
"location": "[variables('location')]", | |
"properties": { | |
"accountType": "[parameters('storageAccountType')]" | |
} | |
}, | |
{ | |
"type": "Microsoft.Network/publicIPAddresses", | |
"apiVersion": "[variables('apiVersion')]", | |
"name": "[variables('publicIPAddressName')]", | |
"location": "[variables('location')]", | |
"properties": { | |
"publicIPAllocationMethod": "[variables('publicIPAddressType')]", | |
"dnsSettings": { | |
"domainNameLabel": "[variables('dnsLabelPrefix')]" | |
} | |
} | |
} | |
], | |
"outputs": { | |
"storageAccountName": { | |
"type": "string", | |
"value": "[variables('storageAccountName')]" | |
} | |
} | |
} | |
DEPLOY | |
# these key-value pairs are passed into the ARM Template's `parameters` block | |
parameters = { | |
"storageAccountType" = "Standard_GRS" | |
} | |
deployment_mode = "Incremental" | |
} | |
output "storageAccountName" { | |
value = azurerm_template_deployment.example.outputs["storageAccountName"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment