forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
73 lines (69 loc) · 2.54 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
import * as azure from "@pulumi/azure";
import * as pulumi from "@pulumi/pulumi";
// Create a resource group to deploy all ARM template resources into.
const resourceGroup = new azure.core.ResourceGroup("test");
// Create an ARM template deployment using an ordinary JSON ARM template. This could be read from disk, of course.
const armDeployment = new azure.core.TemplateDeployment("test-dep", {
resourceGroupName: resourceGroup.name,
templateBody: JSON.stringify({
"$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",
"dnsLabelPrefix": `${pulumi.getProject()}-${pulumi.getStack()}`,
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "2019-04-01",
"location": "[variables('location')]",
"sku": {
"name": "[parameters('storageAccountType')]",
},
},
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2019-09-01",
"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",
});
// Finally, export the allocated storage account name.
export const storageAccountName = armDeployment.outputs["storageAccountName"];