TemplateDeploymentArgs

data class TemplateDeploymentArgs(val deploymentMode: Output<String>? = null, val name: Output<String>? = null, val parameters: Output<Map<String, String>>? = null, val parametersBody: Output<String>? = null, val resourceGroupName: Output<String>? = null, val templateBody: Output<String>? = null) : ConvertibleToJava<TemplateDeploymentArgs>

Manages a template deployment of resources

Note on ARM Template Deployments: Due to the way the underlying Azure API is designed, this provider can only manage the deployment of the ARM Template - and not any resources which are created by it. This means that when deleting the azure.core.TemplateDeployment resource, this provider will only remove the reference to the deployment, whilst leaving any resources created by that ARM Template Deployment. One workaround for this is to use a unique Resource Group for each ARM Template Deployment, which means deleting the Resource Group would contain any resources created within it - however this isn't ideal. More information.

Example Usage

Note: This example uses Storage Accounts and Public IP's which are natively supported by this provider - we'd highly recommend using the Native Resources where possible instead rather than an ARM Template, for the reasons outlined above.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.core.TemplateDeployment;
import com.pulumi.azure.core.TemplateDeploymentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleTemplateDeployment = new TemplateDeployment("exampleTemplateDeployment", TemplateDeploymentArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.templateBody("""
{
"$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": "example-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')]"
}
}
}
""")
.parameters(Map.of("storageAccountType", "Standard_GRS"))
.deploymentMode("Incremental")
.build());
ctx.export("storageAccountName", exampleTemplateDeployment.outputs().applyValue(outputs -> outputs.storageAccountName()));
}
}

Note

This provider does not know about the individual resources created by Azure using a deployment template and therefore cannot delete these resources during a destroy. Destroying a template deployment removes the associated deployment operations, but will not delete the Azure resources created by the deployment. In order to delete these resources, the containing resource group must also be destroyed. More information.

Constructors

Link copied to clipboard
fun TemplateDeploymentArgs(deploymentMode: Output<String>? = null, name: Output<String>? = null, parameters: Output<Map<String, String>>? = null, parametersBody: Output<String>? = null, resourceGroupName: Output<String>? = null, templateBody: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): TemplateDeploymentArgs

Properties

Link copied to clipboard
val deploymentMode: Output<String>? = null

Specifies the mode that is used to deploy resources. This value could be either Incremental or Complete. Note that you will almost always want this to be set to Incremental otherwise the deployment will destroy all infrastructure not specified within the template, and this provider will not be aware of this.

Link copied to clipboard
val name: Output<String>? = null

Specifies the name of the template deployment. Changing this forces a new resource to be created.

Link copied to clipboard
val parameters: Output<Map<String, String>>? = null

Specifies the name and value pairs that define the deployment parameters for the template.

Link copied to clipboard
val parametersBody: Output<String>? = null

Specifies a valid Azure JSON parameters file that define the deployment parameters. It can contain KeyVault references

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group in which to create the template deployment. Changing this forces a new resource to be created.

Link copied to clipboard
val templateBody: Output<String>? = null

Specifies the JSON definition for the template.