Skip to content

azurermApiManagementApiSchema

Manages an API Schema 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.*/
new azurerm.provider.AzurermProvider(this, "azurerm", {
  features: [{}],
});
const dataAzurermApiManagementApiExample =
  new azurerm.dataAzurermApiManagementApi.DataAzurermApiManagementApi(
    this,
    "example",
    {
      api_management_name: "search-api-management",
      name: "search-api",
      resource_group_name: "search-service",
      revision: "2",
    }
  );
const azurermApiManagementApiSchemaExample =
  new azurerm.apiManagementApiSchema.ApiManagementApiSchema(this, "example_2", {
    api_management_name: dataAzurermApiManagementApiExample.apiManagementName,
    api_name: dataAzurermApiManagementApiExample.name,
    content_type: "application/vnd.ms-azure-apim.xsd+xml",
    resource_group_name: dataAzurermApiManagementApiExample.resourceGroupName,
    schema_id: "example-schema",
    value: '${file("api_management_api_schema.xml")}',
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementApiSchemaExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • schemaId - (Required) A unique identifier for this API Schema. Changing this forces a new resource to be created.

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

  • apiManagementName - (Required) The Name of the API Management Service where the API exists. 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.

  • contentType - (Required) The content type of the API Schema.

  • value - (Optional) The JSON escaped string defining the document representing the Schema.

  • components - (Optional) Types definitions. Used for Swagger/OpenAPI v2/v3 schemas only.

  • definitions - (Optional) Types definitions. Used for Swagger/OpenAPI v1 schemas only.

Attributes Reference

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

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

Timeouts

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

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

Import

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

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