Skip to content

azurermApiManagementApiPolicy

Manages an API Management API Policy

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 dataAzurermApiManagementApiExample =
  new azurerm.dataAzurermApiManagementApi.DataAzurermApiManagementApi(
    this,
    "example",
    {
      api_management_name: "example-apim",
      name: "my-api",
      resource_group_name: "search-service",
      revision: "2",
    }
  );
const azurermApiManagementApiPolicyExample =
  new azurerm.apiManagementApiPolicy.ApiManagementApiPolicy(this, "example_1", {
    api_management_name: dataAzurermApiManagementApiExample.apiManagementName,
    api_name: dataAzurermApiManagementApiExample.name,
    resource_group_name: dataAzurermApiManagementApiExample.resourceGroupName,
    xml_content:
      '<policies>\n  <inbound>\n    <find-and-replace from="xyz" to="abc" />\n  </inbound>\n</policies>\n',
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementApiPolicyExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

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

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

  • xmlContent - (Optional) The XML Content for this Policy as a string. An XML file can be used here with Terraform's file function that is similar to Microsoft's policyFilePath option.

  • xmlLink - (Optional) A link to a Policy XML Document, which must be publicly available.

Attributes Reference

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

  • id - The ID of the API Management API Policy.

Timeouts

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

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

Import

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

terraform import azurerm_api_management_api_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/exampleId/policies/policy