Skip to content

azurermRedisFirewallRule

Manages a Firewall Rule associated with a 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";
import * as random from "./.gen/providers/random";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm, random.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "redis-resourcegroup",
  }
);
const randomIdServer = new random.id.Id(this, "server", {
  byte_length: 8,
  keepers: [
    {
      azi_id: 1,
    },
  ],
});
const azurermRedisCacheExample = new azurerm.redisCache.RedisCache(
  this,
  "example_2",
  {
    capacity: 1,
    enable_non_ssl_port: false,
    family: "P",
    location: azurermResourceGroupExample.location,
    name: `redis\${${randomIdServer.hex}}`,
    redis_configuration: [
      {
        maxmemory_delta: 2,
        maxmemory_policy: "allkeys-lru",
        maxmemory_reserved: 2,
      },
    ],
    resource_group_name: azurermResourceGroupExample.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.*/
azurermRedisCacheExample.overrideLogicalId("example");
const azurermRedisFirewallRuleExample =
  new azurerm.redisFirewallRule.RedisFirewallRule(this, "example_3", {
    end_ip: "2.3.4.5",
    name: "someIPrange",
    redis_cache_name: azurermRedisCacheExample.name,
    resource_group_name: azurermResourceGroupExample.name,
    start_ip: "1.2.3.4",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermRedisFirewallRuleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

  • redisCacheName - (Required) The name of the Redis Cache. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

  • startIp - (Required) The lowest IP address included in the range

  • endIp - (Required) The highest IP address included in the range.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Redis Firewall Rule.

Timeouts

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

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

Import

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

terraform import azurerm_redis_firewall_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/firewallRules/rule1