Azure API Management Product API

This page shows how to write Terraform and Azure Resource Manager for API Management Product API and write them securely.

azurerm_api_management_product_api (Terraform)

The Product API in API Management can be configured in Terraform with the resource name azurerm_api_management_product_api. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

apim_nodo_services.tf#L23
resource "azurerm_api_management_product_api" "apim_nodo_pagamenti_products_psp_c" {
  product_id          = module.apim_nodo_pagamenti_product[0].product_id
  api_name            = resource.azurerm_api_management_api.apim_nodo_pagamenti_api_psp_cli.name # api ref
  api_management_name = module.apim.name
  resource_group_name = azurerm_resource_group.rg_api.name
}
product.tf#L2
resource "azurerm_api_management_product_api" "product_link" {

  resource_group_name = var.context.resource_group_name

  api_name            = azurerm_api_management_api.api.name
  product_id          = var.service_settings.product_id
24-api-management-product-api.tf#L1
resource "azurerm_api_management_product_api" "hmi_apim_product_api" {
  api_name            = azurerm_api_management_api.hmi_apim_api.name
  product_id          = azurerm_api_management_product.hmi_apim_product.product_id
  api_management_name = azurerm_api_management.hmi_apim.name
  resource_group_name = azurerm_resource_group.hmi_apim_rg.name
}
24-api-management-product-api.tf#L1
resource "azurerm_api_management_product_api" "pip_apim_product_api" {
  api_name            = azurerm_api_management_api.pip_apim_api.name
  product_id          = azurerm_api_management_product.pip_apim_product.product_id
  api_management_name = azurerm_api_management.pip_apim.name
  resource_group_name = azurerm_resource_group.pip_apim_rg.name
}
24-api-management-product-api.tf#L1
resource "azurerm_api_management_product_api" "hmi_apim_product_api" {
  api_name            = azurerm_api_management_api.hmi_apim_api.name
  product_id          = azurerm_api_management_product.hmi_apim_product.product_id
  api_management_name = azurerm_api_management.hmi_apim.name
  resource_group_name = azurerm_resource_group.hmi_apim_rg.name
}
product.tf#L2
resource "azurerm_api_management_product_api" "product_link" {

  count = length(var.service_settings.product_id)
  resource_group_name = var.context.resource_group_name

  api_name            = azurerm_api_management_api.api.name
product-myfirstproduct.tf#L31
resource "azurerm_api_management_product_api" "my-first-servicemyfirstproduct" {
  resource_group_name = azurerm_resource_group.base.name
  api_management_name = azurerm_api_management.base.name
  product_id          = azurerm_api_management_product.mydevelopers.product_id
  api_name            = "my-first-service"
}
product-myfirstproduct.tf#L31
resource "azurerm_api_management_product_api" "my-first-servicemyfirstproduct" {
  resource_group_name = azurerm_resource_group.base.name
  api_management_name = azurerm_api_management.base.name
  product_id          = azurerm_api_management_product.mydevelopers.product_id
  api_name            = "my-first-service"
}
product-myfirstproduct.tf#L31
resource "azurerm_api_management_product_api" "my-first-servicemyfirstproduct" {
  resource_group_name = azurerm_resource_group.base.name
  api_management_name = azurerm_api_management.base.name
  product_id          = azurerm_api_management_product.mydevelopers.product_id
  api_name            = "my-first-service"
}
product-myfirstproduct.tf#L31
resource "azurerm_api_management_product_api" "my-first-servicemyfirstproduct" {
  resource_group_name = azurerm_resource_group.base.name
  api_management_name = azurerm_api_management.base.name
  product_id          = azurerm_api_management_product.mydevelopers.product_id
  api_name            = "my-first-service"
}

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an API Management API Assignment to a Product.

Microsoft.ApiManagement/service/products/apis (Azure Resource Manager)

The service/products/apis in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/products/apis. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

  • apiVersion required - string
  • name required - string

    API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.

  • type required - string

Frequently asked questions

What is Azure API Management Product API?

Azure API Management Product API is a resource for API Management of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure API Management Product API?

For Terraform, the pagopa/pagopa-infra, aadi555/azurerm and hmcts/fh-hmi-api-gateway source code examples are useful. See the Terraform Example section for further details.