Skip to content

azurermRedisLinkedServer

Manages a Redis Linked Server (ie Geo Location)

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 azurermResourceGroupExamplePrimary =
  new azurerm.resourceGroup.ResourceGroup(this, "example-primary", {
    location: "East US",
    name: "example-resources-primary",
  });
const azurermResourceGroupExampleSecondary =
  new azurerm.resourceGroup.ResourceGroup(this, "example-secondary", {
    location: "West US",
    name: "example-resources-secondary",
  });
const azurermRedisCacheExamplePrimary = new azurerm.redisCache.RedisCache(
  this,
  "example-primary_2",
  {
    capacity: 1,
    enable_non_ssl_port: false,
    family: "P",
    location: azurermResourceGroupExamplePrimary.location,
    name: "example-cache1",
    redis_configuration: [
      {
        maxmemory_delta: 2,
        maxmemory_policy: "allkeys-lru",
        maxmemory_reserved: 2,
      },
    ],
    resource_group_name: azurermResourceGroupExamplePrimary.name,
    sku_name: "Premium",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRedisCacheExamplePrimary.overrideLogicalId("example-primary");
const azurermRedisCacheExampleSecondary = new azurerm.redisCache.RedisCache(
  this,
  "example-secondary_3",
  {
    capacity: 1,
    enable_non_ssl_port: false,
    family: "P",
    location: azurermResourceGroupExampleSecondary.location,
    name: "example-cache2",
    redis_configuration: [
      {
        maxmemory_delta: 2,
        maxmemory_policy: "allkeys-lru",
        maxmemory_reserved: 2,
      },
    ],
    resource_group_name: azurermResourceGroupExampleSecondary.name,
    sku_name: "Premium",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRedisCacheExampleSecondary.overrideLogicalId("example-secondary");
new azurerm.redisLinkedServer.RedisLinkedServer(this, "example-link", {
  linked_redis_cache_id: azurermRedisCacheExampleSecondary.id,
  linked_redis_cache_location: azurermRedisCacheExampleSecondary.location,
  resource_group_name: azurermRedisCacheExamplePrimary.resourceGroupName,
  server_role: "Secondary",
  target_redis_cache_name: azurermRedisCacheExamplePrimary.name,
});

Arguments Reference

The following arguments are supported:

  • linkedRedisCacheId - (Required) The ID of the linked Redis cache. Changing this forces a new Redis to be created.

  • linkedRedisCacheLocation - (Required) The location of the linked Redis cache. Changing this forces a new Redis to be created.

  • targetRedisCacheName - (Required) The name of Redis cache to link with. Changing this forces a new Redis to be created. (eg The primary role)

  • resourceGroupName - (Required) The name of the Resource Group where the Redis caches exists. Changing this forces a new Redis to be created.

  • serverRole - (Required) The role of the linked Redis cache (eg "Secondary"). Changing this forces a new Redis to be created. Possible values are primary and secondary.

Attributes Reference

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

  • id - The ID of the Redis.

  • name - The name of the linked server.

Timeouts

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

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

Import

Redis can be imported using the resourceId, e.g.

terraform import azurerm_redis_linked_server.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/linkedServers/cache2