forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
64 lines (57 loc) · 1.73 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
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as azure from "@pulumi/azure";
import * as pulumi from "@pulumi/pulumi";
const config = new pulumi.Config();
const username = config.require("username");
const password = config.require("password");
// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("spark-rg");
// Create a storage account and a container for Spark
const storageAccount = new azure.storage.Account("sparksa", {
resourceGroupName: resourceGroup.name,
accountReplicationType: "LRS",
accountTier: "Standard",
});
const storageContainer = new azure.storage.Container("spark", {
storageAccountName: storageAccount.name,
containerAccessType: "private",
});
// Create a Spark cluster in HDInsight
const sparkCluster = new azure.hdinsight.SparkCluster("myspark", {
resourceGroupName: resourceGroup.name,
clusterVersion: "3.6",
componentVersion: {
spark: "2.3",
},
tier: "Standard",
storageAccounts: [{
isDefault: true,
storageAccountKey: storageAccount.primaryAccessKey,
storageContainerId: storageContainer.id,
}],
gateway: {
enabled: true,
username,
password,
},
roles: {
headNode: {
vmSize: "Standard_D12_v2",
username,
password,
},
workerNode: {
targetInstanceCount: 3,
vmSize: "Standard_D12_v2",
username,
password,
},
zookeeperNode: {
vmSize: "Standard_D12_v2",
username,
password,
},
},
});
// Export the endpoint
export const endpoint = pulumi.interpolate`https://${sparkCluster.httpsEndpoint}/`;