Azure API Management API
This page shows how to write Terraform and Azure Resource Manager for API Management API and write them securely.
azurerm_api_management_api (Terraform)
The API in API Management can be configured in Terraform with the resource name azurerm_api_management_api. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_api_management_api" "rivers" {
name = "rivers"
display_name = "rivers"
path = "rivers"
resource_group_name = var.rg_name
api_management_name =azurerm_api_management.apim.name
resource "azurerm_api_management_api" "apim_nodo_pagamenti_api_psp_svr" {
# source = "git::https://github.com/pagopa/azurerm.git//api_management_api?ref=v1.0.16"
name = format("%s-nodo-pagamenti-psp-svr-api", var.env_short)
api_management_name = module.apim.name
resource_group_name = azurerm_resource_group.rg_api.name
resource "azurerm_api_management_api" "example" {
name = "example-api"
resource_group_name = azurerm_resource_group.rg.name
api_management_name = azurerm_api_management.apim.name
revision = "1"
display_name = "Example API"
resource "azurerm_api_management_api" "VodafDev" {
name = "example-api"
resource_group_name = azurerm_resource_group.VodafDev.name
api_management_name = azurerm_api_management.VodafDev.name
revision = "1"
display_name = "POI API"
resource "azurerm_api_management_api" "CloudQuickPOCAPIMAPI" {
name = "cloudquickpocsapim-api"
resource_group_name = azurerm_resource_group.CloudQuickPOCAPIMRG.name
api_management_name = azurerm_api_management.CloudQuickPOCAPIM.name
revision = "1"
display_name = "CloudQuickPOCsFirstAPI"
resource "azurerm_api_management_api" "composite-api" {
name = "composite-api"
resource_group_name = azurerm_resource_group.rg.name
api_management_name = azurerm_api_management.apim.name
revision = "1"
display_name = "Composite API"
resource "azurerm_api_management_api" "module" {
name = var.api_name
resource_group_name = var.rg_name
api_management_name = var.apim_name
revision = var.api_revision
display_name = var.api_display_name
resource "azurerm_api_management_api" "attdemo" {
for_each = var.apimgmtdemo
name = each.value["name"]
api_management_name = azurerm_api_management.att-apim[each.value.apim_key].name
resource_group_name = var.apimresourcegroup
revision = each.value["revision"]
resource "azurerm_api_management_api" "CloudQuickPOCAPIMAPI" {
name = "cloudquickpocsapim-api"
resource_group_name = azurerm_resource_group.CloudQuickPOCAPIMRG.name
api_management_name = azurerm_api_management.CloudQuickPOCAPIM.name
revision = "1"
display_name = "CloudQuickPOCsFirstAPI"
resource "azurerm_api_management_api" "api" {
resource_group_name = var.context.resource_group_name
api_management_name = var.service_settings.endpoint_name
Parameters
-
api_management_namerequired - string -
descriptionoptional - string -
display_namerequired - string -
idoptional computed - string -
is_currentoptional computed - bool -
is_onlineoptional computed - bool -
namerequired - string -
pathrequired - string -
protocolsrequired - set of string -
resource_group_namerequired - string -
revisionrequired - string -
service_urloptional computed - string -
soap_pass_throughoptional - bool -
subscription_requiredoptional - bool -
versionoptional computed - string -
version_set_idoptional computed - string -
importlist block-
content_formatrequired - string -
content_valuerequired - string -
wsdl_selectorlist block-
endpoint_namerequired - string -
service_namerequired - string
-
-
-
oauth2_authorizationlist block-
authorization_server_namerequired - string -
scopeoptional - string
-
-
openid_authenticationlist block-
bearer_token_sending_methodsoptional - set of string -
openid_provider_namerequired - string
-
-
subscription_key_parameter_nameslist block -
timeoutssingle block
Explanation in Terraform Registry
Manages an API within an API Management Service.
Microsoft.ApiManagement/service/apis (Azure Resource Manager)
The service/apis in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/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
apiVersionrequired - stringnamerequired - stringAPI 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.
propertiesrequiredapiRevisionoptional - stringDescribes the revision of the API. If no value is provided, default revision 1 is created
apiRevisionDescriptionoptional - stringDescription of the API Revision.
apiTypeoptional - stringType of API to create.
httpcreates a REST APIsoapcreates a SOAP pass-through APIwebsocketcreates websocket APIgraphqlcreates GraphQL API.
apiVersionoptional - stringIndicates the version identifier of the API if the API is versioned
apiVersionDescriptionoptional - stringDescription of the API Version.
apiVersionSetoptionaldescriptionoptional - stringDescription of API Version Set.
idoptional - stringIdentifier for existing API Version Set. Omit this value to create a new Version Set.
nameoptional - stringThe display Name of the API Version Set.
versionHeaderNameoptional - stringName of HTTP header parameter that indicates the API Version if versioningScheme is set to
header.versioningSchemeoptional - stringAn value that determines where the API Version identifier will be located in a HTTP request.
versionQueryNameoptional - stringName of query parameter that indicates the API Version if versioningScheme is set to
query.
apiVersionSetIdoptional - stringA resource identifier for the related ApiVersionSet.
authenticationSettingsoptionaloAuth2optionalauthorizationServerIdoptional - stringOAuth authorization server identifier.
scopeoptional - stringoperations scope.
openidoptionalbearerTokenSendingMethodsoptional - arrayHow to send token to the server.
openidProviderIdoptional - stringOAuth authorization server identifier.
contactoptionalemailoptional - stringThe email address of the contact person/organization. MUST be in the format of an email address
nameoptional - stringThe identifying name of the contact person/organization
urloptional - stringThe URL pointing to the contact information. MUST be in the format of a URL
descriptionoptional - stringDescription of the API. May include HTML formatting tags.
displayNameoptional - stringAPI name. Must be 1 to 300 characters long.
formatoptional - stringFormat of the Content in which the API is getting imported.
isCurrentoptional - booleanIndicates if API revision is current api revision.
licenseoptionalnameoptional - stringThe license name used for the API
urloptional - stringA URL to the license used for the API. MUST be in the format of a URL
pathrequired - stringRelative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.
protocolsoptional - arrayDescribes on which protocols the operations in this API can be invoked.
serviceUrloptional - stringAbsolute URL of the backend service implementing this API. Cannot be more than 2000 characters long.
sourceApiIdoptional - stringAPI identifier of the source API.
subscriptionKeyParameterNamesoptionalheaderoptional - stringSubscription key header name.
queryoptional - stringSubscription key query string parameter name.
subscriptionRequiredoptional - booleanSpecifies whether an API or Product subscription is required for accessing the API.
termsOfServiceUrloptional - stringA URL to the Terms of Service for the API. MUST be in the format of a URL.
typeoptional - stringType of API.
valueoptional - stringContent value when Importing an API.
wsdlSelectoroptionalwsdlEndpointNameoptional - stringName of endpoint(port) to import from WSDL
wsdlServiceNameoptional - stringName of service to import from WSDL
typerequired - string
Frequently asked questions
What is Azure API Management API?
Azure API Management 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 API?
For Terraform, the badgerowluke/whitewaterfinder, pagopa/pagopa-infra and 0GiS0/az-api-management-devops source code examples are useful. See the Terraform Example section for further details.