Azure API Management Subscription
This page shows how to write Terraform and Azure Resource Manager for API Management Subscription and write them securely.
azurerm_api_management_subscription (Terraform)
The Subscription in API Management can be configured in Terraform with the resource name azurerm_api_management_subscription. The following sections describe 7 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_api_management_subscription" "subscription" {
api_management_name = var.apim_name
resource_group_name = var.resource_group_name
user_id = var.user_id
product_id = var.product_id
resource "azurerm_api_management_subscription" "subscription" {
api_management_name = var.apim_name
resource_group_name = var.resource_group_name
user_id = var.user_id
product_id = var.product_id
resource "azurerm_api_management_subscription" "module" {
api_management_name = var.apim_name
resource_group_name = var.rg_name
user_id = var.apim_user_id
product_id = var.apim_product_id
resource "azurerm_api_management_subscription" "subscription" {
api_management_name = var.service_settings.api_management_name
resource_group_name = var.context.resource_group_name
user_id = var.service_settings.user_id
product_id = var.service_settings.product_id
resource "azurerm_api_management_subscription" "subscription" {
count = length(var.subscription)
api_management_name = element(var.api_management_name, lookup(var.subscription[count.index], "api_management_id"))
display_name = lookup(var.subscription[count.index], "display_name")
product_id = element(var.product_id, lookup(var.subscription[count.index], "product_id"))
resource_group_name = var.resource_group_name
resource "azurerm_api_management_subscription" "this" {
api_management_name = var.api_management_name
display_name = var.display_name
primary_key = var.primary_key
product_id = var.product_id
resource_group_name = var.resource_group_name
resource "azurerm_api_management_subscription" "this" {
api_management_name = var.api_management_name
display_name = var.display_name
primary_key = var.primary_key
product_id = var.product_id
resource_group_name = var.resource_group_name
Parameters
-
allow_tracingoptional - bool -
api_management_namerequired - string -
display_namerequired - string -
idoptional computed - string -
primary_keyoptional computed - string -
product_idoptional - string -
resource_group_namerequired - string -
secondary_keyoptional computed - string -
stateoptional - string -
subscription_idoptional computed - string -
user_idoptional - string -
timeoutssingle block
Explanation in Terraform Registry
Manages a Subscription within a API Management Service.
Microsoft.ApiManagement/service/subscriptions (Azure Resource Manager)
The service/subscriptions in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/subscriptions. 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
apiVersionrequired - stringnamerequired - stringSubscription entity Identifier. The entity represents the association between a user and a product in API Management.
propertiesrequiredallowTracingoptional - booleanDetermines whether tracing can be enabled
displayNamerequired - stringSubscription name.
ownerIdoptional - stringUser (user id path) for whom subscription is being created in form /users/{userId}
primaryKeyoptional - stringPrimary subscription key. If not specified during request key will be generated automatically.
scoperequired - stringScope like /products/{productId} or /apis or /apis/{apiId}.
secondaryKeyoptional - stringSecondary subscription key. If not specified during request key will be generated automatically.
stateoptional - stringInitial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are active – the subscription is active, suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, rejected – the subscription request has been denied by an administrator, cancelled – the subscription has been cancelled by the developer or administrator, expired – the subscription reached its expiration date and was deactivated.
typerequired - string
Frequently asked questions
What is Azure API Management Subscription?
Azure API Management Subscription 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 Subscription?
For Terraform, the markti/terraform-azure, aadi555/azurerm and jessewilk/terraform source code examples are useful. See the Terraform Example section for further details.