Skip to content

Commit

Permalink
Improve the Cosmos App example (pulumi#448)
Browse files Browse the repository at this point in the history
* Clean up the CosmosApp component

* Restore index
  • Loading branch information
mikhailshilkov authored and stack72 committed Oct 28, 2019
1 parent d158d0c commit b953ac8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
18 changes: 0 additions & 18 deletions azure-ts-cosmosapp-component/functionApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,3 @@ export const functions = new CosmosApp("functions", {
containerName: "products",
factory: buildFunctionApp,
});

export function buildProductApp({ resourceGroup, cosmosAccount, opts }: GlobalContext) {
return ({ location }: RegionalContext) => {
const app = new azure.appservice.ArchiveFunctionApp("function-app", {
resourceGroupName: resourceGroup.name,
archive: new pulumi.asset.FileArchive("./app"),
appSettings: {
COSMOSDB_ENDPOINT: cosmosAccount.endpoint,
COSMOSDB_KEY: cosmosAccount.primaryMasterKey,
COSMOSDB_LOCATION: location,
},
}, opts);

return {
id: app.functionApp.id,
};
};
}
6 changes: 5 additions & 1 deletion azure-ts-cosmosapp-component/vms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ function buildVMScaleSetApp({ cosmosAccount, database, container, opts }: Global
const file = readFileSync("./vm/vmCustomData.yaml").toString();

return ({ location }: RegionalContext) => {
const domainName = new random.RandomString(`pipdns${location}`, { length: 10, special: false, upper: false }).result;
const domainName = new random.RandomString(`pipdns${location}`, { length: 10, special: false, upper: false, number: false }).result;

const publicIp = new azure.network.PublicIp(`pip-${location}`, {
resourceGroupName: resourceGroup.name,
location,
allocationMethod: "Static",
domainNameLabel: domainName,
}, opts);

const loadBalancer = new azure.lb.LoadBalancer(`lb-${location}`, {
resourceGroupName: resourceGroup.name,
location,
frontendIpConfigurations: [{
name: "PublicIPAddress",
publicIpAddressId: publicIp.id,
Expand Down Expand Up @@ -59,6 +61,7 @@ function buildVMScaleSetApp({ cosmosAccount, database, container, opts }: Global

const vnet = new azure.network.VirtualNetwork(`vnet-${location}`, {
resourceGroupName: resourceGroup.name,
location,
addressSpaces: ["10.0.0.0/16"],
}, opts);

Expand All @@ -80,6 +83,7 @@ function buildVMScaleSetApp({ cosmosAccount, database, container, opts }: Global

const scaleSet = new azure.compute.ScaleSet(`vmss-${location}`, {
resourceGroupName: resourceGroup.name,
location,
networkProfiles: [{
ipConfigurations: [{
loadBalancerBackendAddressPoolIds: [bpepool.id],
Expand Down

0 comments on commit b953ac8

Please sign in to comment.