At the time of writing, there is no native Pulumi resource for defining an API Connection and linking it to a Logic App. This example shows how to use an ARM templates to create an API Connection and a Logic App.
- Node.js
- Download and install the Pulumi CLI
- Connect Pulumi with your Azure account (if your
az
CLI is configured, no further changes are required)
-
Create a new stack:
$ pulumi stack init dev
-
Set the required configuration variables for this program, and log into Azure:
$ pulumi config set azure:location westeurope $ az login
-
Perform the deployment:
$ pulumi up Type Name Status + pulumi:pulumi:Stack azure-cosmosdb-logicapp-dev created + ├─ azure:core:ResourceGroup logicappdemo-rg created + ├─ azure:cosmosdb:Account logicappdemo-cdb created + ├─ azure:storage:Account logicappdemosa created + ├─ azure:cosmosdb:SqlDatabase db created + ├─ azure:cosmosdb:SqlContainer container created + ├─ azure:core:TemplateDeployment db-connection created + ├─ azure:core:TemplateDeployment logic-app created + └─ azure:logicapps:ActionCustom Create_or_update_document created Resources: + 9 created Duration: 15m10s
-
At this point, you have a Cosmos DB collection and a Logic App listening to HTTP requests. You can trigger the Logic App with a
curl
command:$ curl -X POST '$(pulumi stack output endpoint)' -d '"Hello World"' -H 'Content-Type: application/json'
The POST body will be saved into a new document in the Cosmos DB collection.
-
Once you are done, you can destroy all of the resources, and the stack:
$ pulumi destroy $ pulumi stack rm