Skip to content

azurermApiManagementApi

Manages an API within an API Management Service.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermApiManagementExample = new azurerm.apiManagement.ApiManagement(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-apim",
    publisher_email: "company@terraform.io",
    publisher_name: "My Company",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "Developer_1",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementExample.overrideLogicalId("example");
const azurermApiManagementApiExample =
  new azurerm.apiManagementApi.ApiManagementApi(this, "example_2", {
    api_management_name: azurermApiManagementExample.name,
    display_name: "Example API",
    import: [
      {
        content_format: "swagger-link-json",
        content_value: "http://conferenceapi.azurewebsites.net/?format=json",
      },
    ],
    name: "example-api",
    path: "example",
    protocols: ["https"],
    resource_group_name: azurermResourceGroupExample.name,
    revision: "1",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementApiExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the API Management API. Changing this forces a new resource to be created.

  • apiManagementName - (Required) The Name of the API Management Service where this API should be created. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The Name of the Resource Group where the API Management API exists. Changing this forces a new resource to be created.

  • revision - (Required) The Revision which used for this API. Changing this forces a new resource to be created.


  • apiType - (Optional) Type of API. Possible values are graphql, http, soap, and websocket. Defaults to http.

  • displayName - (Optional) The display name of the API.

  • path - (Optional) The Path for this API Management API, which is a relative URL which uniquely identifies this API and all of its resource paths within the API Management Service.

  • protocols - (Optional) A list of protocols the operations in this API can be invoked. Possible values are http, https, ws, and wss.

-> NOTE: displayName, path and protocols are required when sourceApiId is not set.

  • contact - (Optional) A contact block as documented below.

  • description - (Optional) A description of the API Management API, which may include HTML formatting tags.

  • import - (Optional) A import block as documented below.

  • license - (Optional) A license block as documented below.

  • oauth2Authorization - (Optional) An oauth2Authorization block as documented below.

  • openidAuthentication - (Optional) An openidAuthentication block as documented below.

  • serviceUrl - (Optional) Absolute URL of the backend service implementing this API.

  • soapPassThrough - (Optional) Should this API expose a SOAP frontend, rather than a HTTP frontend? Defaults to false.

-> NOTE: This property has been deprecated in favour of the apiType property and will be removed in version 4.0 of the provider.

  • subscriptionKeyParameterNames - (Optional) A subscriptionKeyParameterNames block as documented below.

  • subscriptionRequired - (Optional) Should this API require a subscription key? Defaults to true.

  • termsOfServiceUrl - (Optional) Absolute URL of the Terms of Service for the API.

  • version - (Optional) The Version number of this API, if this API is versioned.

  • versionSetId - (Optional) The ID of the Version Set which this API is associated with.

-> NOTE: When version is set, versionSetId must also be specified

  • revisionDescription - (Optional) The description of the API Revision of the API Management API.

  • versionDescription - (Optional) The description of the API Version of the API Management API.

  • sourceApiId - (Optional) The API id of the source API, which could be in format azurermApiManagementApiExampleId or in format azurermApiManagementApiExampleId;rev=1


A contact block supports the following:

  • email - (Optional) The email address of the contact person/organization.

  • name - (Optional) The name of the contact person/organization.

  • url - (Optional) Absolute URL of the contact information.


A import block supports the following:

  • contentFormat - (Required) The format of the content from which the API Definition should be imported. Possible values are: openapi, openapi+json, openapi+jsonLink, openapiLink, swaggerJson, swaggerLinkJson, wadlLinkJson, wadlXml, wsdl and wsdlLink.

  • contentValue - (Required) The Content from which the API Definition should be imported. When a contentFormat of *Link-* is specified this must be a URL, otherwise this must be defined inline.

  • wsdlSelector - (Optional) A wsdlSelector block as defined below, which allows you to limit the import of a WSDL to only a subset of the document. This can only be specified when contentFormat is wsdl or wsdlLink.


A license block supports the following:

  • name - (Optional) The name of the license .

  • url - (Optional) Absolute URL of the license.


A oauth2Authorization block supports the following:

  • authorizationServerName - (Required) OAuth authorization server identifier. The name of an OAuth2 Authorization Server.

  • scope - (Optional) Operations scope.


A openidAuthentication block supports the following:

  • openidProviderName - (Required) OpenID Connect provider identifier. The name of an OpenID Connect Provider.

  • bearerTokenSendingMethods - (Optional) How to send token to the server. A list of zero or more methods. Valid values are authorizationHeader and query.


A subscriptionKeyParameterNames block supports the following:

  • header - (Required) The name of the HTTP Header which should be used for the Subscription Key.

  • query - (Required) The name of the QueryString parameter which should be used for the Subscription Key.


A wsdlSelector block supports the following:

  • serviceName - (Required) The name of service to import from WSDL.

  • endpointName - (Required) The name of endpoint (port) to import from WSDL.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the API Management API.

  • isCurrent - Is this the current API Revision?

  • isOnline - Is this API Revision online/accessible via the Gateway?

  • version - (Optional) The Version number of this API, if this API is versioned.

  • versionSetId - (Optional) The ID of the Version Set which this API is associated with.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the API Management API.
  • update - (Defaults to 30 minutes) Used when updating the API Management API.
  • read - (Defaults to 5 minutes) Used when retrieving the API Management API.
  • delete - (Defaults to 30 minutes) Used when deleting the API Management API.

Import

API Management API's can be imported using the resourceId, e.g.

terraform import azurerm_api_management_api.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/apis/api1