Skip to content

azurermApiManagementRedisCache

Manages a API Management Redis Cache.

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: "pub1@email.com",
    publisher_name: "pub1",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "Consumption_0",
  }
);
/*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 azurermRedisCacheExample = new azurerm.redisCache.RedisCache(
  this,
  "example_2",
  {
    capacity: 1,
    enable_non_ssl_port: false,
    family: "C",
    location: azurermResourceGroupExample.location,
    minimum_tls_version: "1.2",
    name: "example-cache",
    redis_configuration: [{}],
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "Basic",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRedisCacheExample.overrideLogicalId("example");
const azurermApiManagementRedisCacheExample =
  new azurerm.apiManagementRedisCache.ApiManagementRedisCache(
    this,
    "example_3",
    {
      api_management_id: azurermApiManagementExample.id,
      cache_location: "East Us",
      connection_string: azurermRedisCacheExample.primaryConnectionString,
      description: "Redis cache instances",
      name: "example-Redis-Cache",
      redis_cache_id: azurermRedisCacheExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApiManagementRedisCacheExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this API Management Redis Cache. Changing this forces a new API Management Redis Cache to be created.

  • apiManagementId - (Required) The resource ID of the API Management Service from which to create this external cache. Changing this forces a new API Management Redis Cache to be created.

  • connectionString - (Required) The connection string to the Cache for Redis.


  • description - (Optional) The description of the API Management Redis Cache.

  • redisCacheId - (Optional) The resource ID of the Cache for Redis.

  • cacheLocation - (Optional) The location where to use cache from. Possible values are default and valid Azure regions. Defaults to default.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the API Management Redis Cache.

Timeouts

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

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

Import

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

terraform import azurerm_api_management_redis_cache.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/caches/cache1