Is it already possible to use AzAPI in CDKTF?

I’m currently providing Azure infrastructure with CDKTF (TypeScript or Java). I would like to create “Azure Container Apps”. It looks like that this is only possible using AzAPI. Is it possible to use the AzAPI in CDKTF projects? I wasn’t able to find any kind of documentation.

Thx! :coffee:

Hi @Aldjinn :wave:

Yes, you can use the AzAPI Terraform provider in CDKTF. We don’t have pre-built provider bindings for it, but you can generate the bindings locally (using cdktf get).

You can run cdktf provider add azure/azapi which will add and locally build the provider for you.


Thx @ansgarm. That did the trick. :+1:

Now I’m able to create AzAPI resources. Is there any convenient possibility to write the “body” in an easy way?

resource "azapi_resource" "aca_env" {
  type      = "Microsoft.App/managedEnvironments@2022-03-01"
  parent_id =
  location  = azurerm_resource_group.rg.location
  name      = "aca-env-terraform"
  tags      = local.tags
  body   = jsonencode({
    properties = {
      appLogsConfiguration = {
        destination               = "log-analytics"
        logAnalyticsConfiguration = {
          customerId =
          sharedKey  =

Source: How to Deploy Azure Container Apps with Terraform · Thorsten Hans' blog

Hi @Aldjinn,

that’s great!

You could to something like:

body: Fn.jsonencode({ properties: { appLogsConfiguration: { /* ... */ } }})

But I don’t think there are types for the inner configuration of body available for Java or TypeScript. But I have not done extensive research on whether they exist somewhere or could be generated based on something that exists.