Skip to content

Instantly share code, notes, and snippets.

@AdoraNwodo
Last active May 16, 2020 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdoraNwodo/291b10e8e6adf69412472d4d9eabb4cc to your computer and use it in GitHub Desktop.
Save AdoraNwodo/291b10e8e6adf69412472d4d9eabb4cc to your computer and use it in GitHub Desktop.
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const environment = pulumi.getStack();
const location = "WestEurope";
const resourceGroupName = "tutorial-rg";
const appservicePlanName = "tutorial-plan";
const storageAccountName = "tutorialstore";
const functionAppName = "tutorial-app";
// Create Resource Group
export const resourceGroup = new azure.core.ResourceGroup(resourceGroupName,
{
location,
name: resourceGroupName,
tags: {
environment
}
});
// Create app service plan
export const asp = new azure.appservice.Plan(appservicePlanName, {
kind: "App",
location,
name: appservicePlanName,
resourceGroupName: resourceGroup.name,
sku: {
size: "S1",
tier: "Premium V2"
},
maximumElasticWorkerCount: 1
});
// Storage account for the function app
export const store = new azure.storage.Account(storageAccountName, {
name: storageAccountName,
accountReplicationType: "LRS",
accountTier: "Standard",
location: resourceGroup.location,
accountKind: "StorageV2",
resourceGroupName: resourceGroup.name,
tags: {
environment
}
});
// Create function app
export const app = new azure.appservice.FunctionApp(functionAppName, {
appServicePlanId: asp.id,
location: resourceGroup.location,
resourceGroupName: resourceGroup.name,
storageAccountName: store.name,
storageAccountAccessKey: store.primaryAccessKey,
identity: {
type: "SystemAssigned"
},
appSettings: {
CLOUD_SERVICE_CONFIG: environment
},
siteConfig: {
alwaysOn: true,
use32BitWorkerProcess: false,
websocketsEnabled: false
},
version: "~3",
tags: {
environment
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment