Created
August 26, 2019 09:56
-
-
Save mikhailshilkov/aa477b67520337231e5fdbfc77e21a97 to your computer and use it in GitHub Desktop.
Pulumi and Azure Functions with config values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as pulumi from "@pulumi/pulumi"; | |
import * as azure from "@pulumi/azure"; | |
import * as eventhub from "@pulumi/azure/eventhub"; | |
const resourceGroup = new azure.core.ResourceGroup("test"); | |
const config = new pulumi.Config(); | |
const workspaceID = config.require("workspaceID"); | |
const workspaceKey = config.require("workspaceKey"); | |
const workspaceKeySecret = config.require("workspaceKeySecret"); | |
const namespace = new eventhub.EventHubNamespace("test", { | |
resourceGroupName: resourceGroup.name, | |
sku: "standard", | |
}); | |
const eventHub = new eventhub.EventHub("test", { | |
resourceGroupName: resourceGroup.name, | |
namespaceName: namespace.name, | |
partitionCount: 2, | |
messageRetention: 7, | |
}); | |
eventHub.onEvent("test", async (context, arg) => { | |
console.log(`My workspace ID is ${workspaceID} and key is ${workspaceKey}`); | |
}); | |
eventHub.onEvent("test2", { | |
callback: async (context, arg) => { | |
console.log(`My workspace ID is ${process.env.WORKSPACE_ID} and key is ${process.env.WORKSPACE_KEY}`); | |
}, | |
appSettings: { | |
WORKSPACE_ID: workspaceID, | |
WORKSPACE_KEY: workspaceKeySecret, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment