Class TemplateDeployment
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.TemplateDeploymentresource, 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
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West US",
});
var exampleTemplateDeployment = new Azure.Core.TemplateDeployment("exampleTemplateDeployment", new Azure.Core.TemplateDeploymentArgs
{
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 =
{
{ "storageAccountType", "Standard_GRS" },
},
DeploymentMode = "Incremental",
});
this.StorageAccountName = exampleTemplateDeployment.Outputs.Apply(outputs => outputs.StorageAccountName);
}
[Output("storageAccountName")]
public Output<string> StorageAccountName { get; set; }
}
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.
Inherited Members
Namespace: Pulumi.Azure.Core
Assembly: Pulumi.Azure.dll
Syntax
public class TemplateDeployment : CustomResource
Constructors
View SourceTemplateDeployment(String, TemplateDeploymentArgs, CustomResourceOptions)
Create a TemplateDeployment resource with the given unique name, arguments, and options.
Declaration
public TemplateDeployment(string name, TemplateDeploymentArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| TemplateDeploymentArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceDeploymentMode
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.
Declaration
public Output<string> DeploymentMode { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
Specifies the name of the template deployment. Changing this forces a new resource to be created.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Outputs
A map of supported scalar output types returned from the deployment (currently, Azure Template Deployment outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored) and can be accessed using .outputs["name"].
Declaration
public Output<ImmutableDictionary<string, string>> Outputs { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
Parameters
Specifies the name and value pairs that define the deployment parameters for the template.
Declaration
public Output<ImmutableDictionary<string, string>> Parameters { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
ParametersBody
Specifies a valid Azure JSON parameters file that define the deployment parameters. It can contain KeyVault references
Declaration
public Output<string> ParametersBody { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ResourceGroupName
The name of the resource group in which to create the template deployment.
Declaration
public Output<string> ResourceGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
TemplateBody
Specifies the JSON definition for the template.
Declaration
public Output<string> TemplateBody { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, TemplateDeploymentState, CustomResourceOptions)
Get an existing TemplateDeployment resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static TemplateDeployment Get(string name, Input<string> id, TemplateDeploymentState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| TemplateDeploymentState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| TemplateDeployment |