Create Azure Container Apps with terraform
Microsoft announced at Microsoft Build that Azure Container Apps are now generally available (GA).
If you’re not familiar with Azure Container Apps (ACA) I suggest you to go and check out the documentation here.
Fully managed serverless container service for building and deploying modern apps at scale
This is how Microsoft itself markets the product.
I think it’s a very interesting platform and it offers some of the benefits of Kubernetes, abstracting a lot of concepts and complexity.
In order to start playing around with it, I usually create a repo with some terraform code so I can spin up a set of resources, play with them and then destroy all of them when I’m done.
As you may know not all Azure resources are available in terraform azure provider(s) from day 1, but for a month or so we have the awesome AzApi provider for terraform.
Follow this github issue that tracks adding support for it in the azurerm official provider.
The AzAPI provider enables you to manage any Azure resource type using any API version.
Thanks to this provider it is very easy to create an Azure Container App with terraform.
Here’s how you configure the provider:
Here you can see how you can use azapi_resource to create an Azure Container App
In order to discover the properties, I first make the changes it in the Azure portal, then I’m running the following az-cli command:
az containerapp list
and then you need to transform the json to the terraform equivalent.
You can also install Terraform AzApi Provider Visual Studio Code Extension VS Code extension that should provide completion support.
If you want to see a more advanced example, you can give a look at my repo here.
Hope you find this helpful, if you have any question/suggestion, don’t hesitate to comment!