Skip to content

Commit

Permalink
User azure.Locations instead of plain strings (and fix some AKS error…
Browse files Browse the repository at this point in the history
…s) (pulumi#321)
  • Loading branch information
mikhailshilkov authored and clstokes committed Jun 24, 2019
1 parent ee01437 commit 5549245
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 27 deletions.
6 changes: 1 addition & 5 deletions azure-js-webserver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ let username = config.require("username");
let password = config.require("password");

let resourceGroup = new azure.core.ResourceGroup("server", {
location: "West US",
location: azure.Locations.WestUS,
});

let network = new azure.network.VirtualNetwork("server-network", {
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
addressSpaces: ["10.0.0.0/16"],
// Workaround two issues:
// (1) The Azure API recently regressed and now fails when no subnets are defined at Network creation time.
Expand All @@ -32,13 +31,11 @@ let subnet = new azure.network.Subnet("server-subnet", {

let publicIP = new azure.network.PublicIp("server-ip", {
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
allocationMethod: "Dynamic",
});

let networkInterface = new azure.network.NetworkInterface("server-nic", {
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
ipConfigurations: [{
name: "webserveripcfg",
subnetId: subnet.id,
Expand All @@ -54,7 +51,6 @@ nohup python -m SimpleHTTPServer 80 &`;

let vm = new azure.compute.VirtualMachine("server-vm", {
resourceGroupName: resourceGroup.name,
location: resourceGroup.location,
networkInterfaceIds: [networkInterface.id],
vmSize: "Standard_A0",
deleteDataDisksOnTermination: true,
Expand Down
6 changes: 3 additions & 3 deletions azure-ts-aks-helm/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ let adSpPassword = new azuread.ServicePrincipalPassword("aksSpPassword", {
export const k8sCluster = new azure.containerservice.KubernetesCluster("aksCluster", {
resourceGroupName: config.resourceGroup.name,
location: config.location,
agentPoolProfile: {
agentPoolProfiles: [{
name: "aksagentpool",
count: config.nodeCount,
vmSize: config.nodeSize,
},
}],
dnsPrefix: `${pulumi.getStack()}-kube`,
linuxProfile: {
adminUsername: "aksuser",
Expand All @@ -35,7 +35,7 @@ export const k8sCluster = new azure.containerservice.KubernetesCluster("aksClust
clientId: adApp.applicationId,
clientSecret: adSpPassword.value,
},
});
});

// Expose a K8s provider instance using our custom cluster instance.
export const k8sProvider = new k8s.Provider("aksK8s", {
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-aks-helm/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as pulumi from "@pulumi/pulumi";
// Parse and export configuration variables for this stack.
const config = new pulumi.Config();
export const password = config.require("password");
export const location = config.get("location") || "East US";
export const location = config.get("location") || azure.Locations.EastUS;
export const nodeCount = config.getNumber("nodeCount") || 2;
export const nodeSize = config.get("nodeSize") || "Standard_D2_v2";
export const sshPublicKey = config.require("sshPublicKey");
Expand Down
6 changes: 3 additions & 3 deletions azure-ts-aks-mean/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ let adSpPassword = new azuread.ServicePrincipalPassword("aksSpPassword", {
export const k8sCluster = new azure.containerservice.KubernetesCluster("aksCluster", {
resourceGroupName: config.resourceGroup.name,
location: config.location,
agentPoolProfile: {
agentPoolProfiles: [{
name: "aksagentpool",
count: config.nodeCount,
vmSize: config.nodeSize,
},
}],
dnsPrefix: `${pulumi.getStack()}-kube`,
linuxProfile: {
adminUsername: "aksuser",
Expand All @@ -35,7 +35,7 @@ export const k8sCluster = new azure.containerservice.KubernetesCluster("aksClust
clientId: adApp.applicationId,
clientSecret: adSpPassword.value,
},
});
});

// Expose a K8s provider instance using our custom cluster instance.
export const k8sProvider = new k8s.Provider("aksK8s", {
Expand Down
4 changes: 2 additions & 2 deletions azure-ts-aks-mean/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import * as pulumi from "@pulumi/pulumi";
// Parse and export configuration variables for this stack.
const config = new pulumi.Config();
export const password = config.require("password");
export const location = config.get("location") || "East US";
export const failoverLocation = config.get("failoverLocation") || "East US 2";
export const location = config.get("location") || azure.Locations.EastUS;
export const failoverLocation = config.get("failoverLocation") || azure.Locations.EastUS2;
export const nodeCount = config.getNumber("nodeCount") || 2;
export const nodeSize = config.get("nodeSize") || "Standard_D2_v2";
export const sshPublicKey = config.require("sshPublicKey");
Expand Down
1 change: 0 additions & 1 deletion azure-ts-aks-mean/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { k8sCluster, k8sProvider } from "./cluster";
const cosmosdb = new azure.cosmosdb.Account("cosmosDb", {
kind: "MongoDB",
resourceGroupName: config.resourceGroup.name,
location: config.location,
consistencyPolicy: {
consistencyLevel: "BoundedStaleness",
maxIntervalInSeconds: 10,
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-aks-multicluster/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import * as pulumi from "@pulumi/pulumi";
// Parse and export configuration variables for this stack.
const config = new pulumi.Config();
export const password = config.require("password");
export const location = config.get("location") || "East US";
export const location = config.get("location") || azure.Locations.EastUS;
export const sshPublicKey = config.require("sshPublicKey");
export const resourceGroup = new azure.core.ResourceGroup("aks", {location: location});
8 changes: 4 additions & 4 deletions azure-ts-aks-multicluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import * as config from "./config";
const aksClusterConfig = [
{
name: 'east',
location: "East US",
location: azure.Locations.EastUS,
nodeCount: 2,
nodeSize: "Standard_D2_v2",
},
{
name: 'west',
location: "West US",
location: azure.Locations.WestUS,
nodeCount: 5,
nodeSize: "Standard_D2_v2",
},
Expand Down Expand Up @@ -47,11 +47,11 @@ const k8sClusters = aksClusterConfig.map((perClusterConfig, index) => {
},
// Per-cluster config arguments
location: perClusterConfig.location,
agentPoolProfile: {
agentPoolProfiles: [{
name: "aksagentpool",
count: perClusterConfig.nodeCount,
vmSize: perClusterConfig.nodeSize,
},
}],
dnsPrefix: `${pulumi.getStack()}-kube`,
});
return cluster;
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-appservice-devops/infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as azure from "@pulumi/azure";
const prefix = pulumi.getStack().substring(0, 9);

const resourceGroup = new azure.core.ResourceGroup(`${prefix}-rg`, {
location: "West US 2",
location: azure.Locations.WestUS2,
});

const resourceGroupArgs = {
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-appservice-docker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as docker from "@pulumi/docker";

// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("samples", {
location: "West US",
location: azure.Locations.WestUS,
});

// Create a dedicated App Service Plan for Linux App Services
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-appservice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as azure from "@pulumi/azure";
const prefix = pulumi.getStack().substring(0, 9);

const resourceGroup = new azure.core.ResourceGroup(`${prefix}-rg`, {
location: "West US 2",
location: azure.Locations.WestUS2,
});

const resourceGroupArgs = {
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-arm-template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

// Create a resource group to deploy all ARM template resources into.
const resourceGroup = new azure.core.ResourceGroup("test", { location: "WestUS" });
const resourceGroup = new azure.core.ResourceGroup("test", { location: azure.Locations.WestUS });

// 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", {
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-dynamicresource/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CDNCustomDomainResource } from "./cdnCustomDomain";
* To externalize this value, and make this configurable across environments/stacks,
* learn more at https://pulumi.io/reference/config/.
*/
const location = "West US";
const location = azure.Locations.WestUS;

// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("resourceGroup", {
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-hdinsight-spark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const password = config.require("password");

// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("spark-rg", {
location: "West US",
location: azure.Locations.WestUS,
});

// Create a storage account and a container for Spark
Expand Down
2 changes: 1 addition & 1 deletion azure-ts-static-website/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StorageStaticWebsite } from "./staticWebsite";

// Create an Azure Resource Group
const resourceGroup = new azure.core.ResourceGroup("website-rg", {
location: "West US",
location: azure.Locations.WestUS,
});

// Create a Storage Account for our static website
Expand Down

0 comments on commit 5549245

Please sign in to comment.