Remove mixed subnet usage from azure examples
MODIFY
azure-js-webserver/index.js
azure-js-webserver/index.js
@@ -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",
@@ -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,
}],

MODIFY
azure-ts-webserver-component/index.ts
azure-ts-webserver-component/index.ts
@@ -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 = [];
@@ -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());
}

MODIFY
azure-ts-webserver/index.ts
azure-ts-webserver/index.ts
@@ -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", {
@@ -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,
}],

Remove mixed subnet usage from azure examples (#388)