Azure API Management Product
This page shows how to write Terraform and Azure Resource Manager for API Management Product and write them securely.
azurerm_api_management_product (Terraform)
The Product in API Management can be configured in Terraform with the resource name azurerm_api_management_product
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_api_management_product" "apim_product_std" {
product_id = "training-people-product-std"
api_management_name = data.azurerm_api_management.apim.name
resource_group_name = data.azurerm_resource_group.rg.name
display_name = "PeopleStd"
resource "azurerm_api_management_product" "product" {
resource_group_name = var.context.resource_group_name
product_id = var.service_settings.product_id
api_management_name = var.service_settings.endpoint_name
resource "azurerm_api_management_product" "product" {
resource_group_name = var.context.resource_group_name
product_id = var.service_settings.product_id
api_management_name = var.service_settings.endpoint_name
resource "azurerm_api_management_product" "product" {
product_id = var.product_id
api_management_name = var.apim_name
resource_group_name = var.resource_group_name
display_name = var.description
resource "azurerm_api_management_product" "product" {
for_each = toset(var.products)
product_id = each.key
resource_group_name = var.resource_group_name
api_management_name = azurerm_api_management.apim.name
display_name = each.key
resource "azurerm_api_management_product" "dadjoke" {
product_id = "DadJokeProduct"
resource_group_name = local.resource_group_name
api_management_name = data.azurerm_api_management.apim.name
display_name = "DadJokeProduct"
subscription_required = true
resource "azurerm_api_management_product" "product" {
for_each = { for apim_product in var.apim_product : apim_product.product_id => apim_product }
api_management_name = var.apim_name
resource_group_name = var.apim_resource_group
product_id = each.value.product_id
description = each.value.description
resource "azurerm_api_management_product" "freemium" {
product_id = "freemium"
api_management_name = azurerm_api_management.apim.name
resource_group_name = azurerm_resource_group.rg.name
display_name = "Freemium"
subscription_required = true
resource "azurerm_api_management_product" "this" {
api_management_name = var.api_management_name
approval_required = var.approval_required
description = var.description
display_name = var.display_name
product_id = var.product_id
resource "azurerm_api_management_product" "api_management_product" {
product_id = var.product_id
resource_group_name = var.resource_group_name
api_management_name = var.api_management_name
display_name = var.display_name
description = var.description
Parameters
-
api_management_name
required - string -
approval_required
optional - bool -
description
optional - string -
display_name
required - string -
id
optional computed - string -
product_id
required - string -
published
required - bool -
resource_group_name
required - string -
subscription_required
required - bool -
subscriptions_limit
optional - number -
terms
optional - string -
timeouts
single block
Explanation in Terraform Registry
Manages an API Management Product.
Microsoft.ApiManagement/service/products (Azure Resource Manager)
The service/products in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/products
. 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 - stringname
required - stringProduct identifier. Must be unique in the current API Management service instance.
properties
requiredapprovalRequired
optional - booleanwhether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false.
description
optional - stringProduct description. May include HTML formatting tags.
displayName
required - stringProduct name.
state
optional - stringwhether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished.
subscriptionRequired
optional - booleanWhether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true.
subscriptionsLimit
optional - integerWhether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false.
terms
optional - stringProduct terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process.
type
required - string
Frequently asked questions
What is Azure API Management Product?
Azure API Management Product 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?
For Terraform, the NewSignature/apim-training, aadi555/azurerm and persistentsystems/terraform-azurerm source code examples are useful. See the Terraform Example section for further details.