Skip to content

Commit

Permalink
Remove mixed subnet usage from azure examples (pulumi#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailshilkov authored Sep 12, 2019
1 parent c7008f2 commit d60627b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
11 changes: 1 addition & 10 deletions azure-js-webserver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,12 @@ let resourceGroup = new azure.core.ResourceGroup("server", {
let network = new azure.network.VirtualNetwork("server-network", {
resourceGroupName: resourceGroup.name,
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.
// (2) The Azure Terraform provider does not return the ID of the created subnets - so this cannot actually be used.
subnets: [{
name: "default",
addressPrefix: "10.0.1.0/24",
}],
});

let subnet = new azure.network.Subnet("server-subnet", {
resourceGroupName: resourceGroup.name,
virtualNetworkName: network.name,
addressPrefix: "10.0.2.0/24",
});

let publicIP = new azure.network.PublicIp("server-ip", {
resourceGroupName: resourceGroup.name,
allocationMethod: "Dynamic",
Expand All @@ -38,7 +29,7 @@ let networkInterface = new azure.network.NetworkInterface("server-nic", {
resourceGroupName: resourceGroup.name,
ipConfigurations: [{
name: "webserveripcfg",
subnetId: subnet.id,
subnetId: network.subnets[0].id,
privateIpAddressAllocation: "Dynamic",
publicIpAddressId: publicIP.id,
}],
Expand Down
7 changes: 1 addition & 6 deletions azure-ts-webserver-component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ const network = new azure.network.VirtualNetwork("server-network", {
addressPrefix: "10.0.1.0/24",
}],
});
const subnet = new azure.network.Subnet("server-subnet", {
resourceGroupName,
virtualNetworkName: network.name,
addressPrefix: "10.0.2.0/24",
});

// Now, allocate a few websever VMs -- by default, just 2, but this is configurable.
export const ipAddresses = [];
Expand All @@ -38,7 +33,7 @@ for (let i = 0; i < count; i++) {
echo "Hello, from Server #{i+1}!" > index.html
nohup python -m SimpleHTTPServer 80 &`,
resourceGroupName: resourceGroupName,
subnetId: subnet.id,
subnetId: network.subnets[0].id,
});
ipAddresses.push(server.getIpAddress());
}
7 changes: 1 addition & 6 deletions azure-ts-webserver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ const network = new azure.network.VirtualNetwork("server-network", {
addressPrefix: "10.0.1.0/24",
}],
});
const subnet = new azure.network.Subnet("server-subnet", {
resourceGroupName,
virtualNetworkName: network.name,
addressPrefix: "10.0.2.0/24",
});

// Now allocate a public IP and assign it to our NIC.
const publicIp = new azure.network.PublicIp("server-ip", {
Expand All @@ -36,7 +31,7 @@ const networkInterface = new azure.network.NetworkInterface("server-nic", {
resourceGroupName,
ipConfigurations: [{
name: "webserveripcfg",
subnetId: subnet.id,
subnetId: network.subnets[0].id,
privateIpAddressAllocation: "Dynamic",
publicIpAddressId: publicIp.id,
}],
Expand Down

0 comments on commit d60627b

Please sign in to comment.