Deploy an Azure API Management API with Terraform

We have an ever growing number of APIs hosted in Azure API Manager, in an ever growing number of environments.

Most of our APIs follow the same back end pattern, we have a number Azure Function Apps or Logic apps that talk to either our back end systems or those of a third party.

Deploying API’s manually is a real time sink, not to mention unutterably tedious and prone to transcription errors. I believe that out operations team has had one member of staff doing nothing other than configuring API-M for several weeks.

Every other part of our deployments are scripted and carried out by DevOps pipelines so it has been a constant source of irritation that we have not, until now, been able to eliminate this last manual step.

I have previously tried to use ARM templates to automate our deployments, but I ran out of time on that, towards the end it was just bogged down in the complexity and lack of clarity which ARM brings to the process.

Having recently introduced myself to Terraform, and noticing that it seemed to have a lot of support for API Manager I thought I would put some time aside to revisit APIM with Terraform.

In short, its far easier to use.

What I wanted was to be able to define an entire API, including its back end connections to logic apps or function apps, policy files, etc as a set of variables, hand that to Terraform and let it manage creating and updating the APIs from then on.

It looked like the best way of doing that was to create a Terraform module, this is what I did, and you can access the module here.

Leave a Reply

Your email address will not be published. Required fields are marked *