azure logo
Azure Classic v5.38.0, Mar 21 23

azure.redis.FirewallRule

Manages a Firewall Rule associated with a Redis Cache.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;
using Random = Pulumi.Random;

return await Deployment.RunAsync(() => 
{
    var server = new Random.RandomId("server", new()
    {
        Keepers = 
        {
            { "azi_id", 1 },
        },
        ByteLength = 8,
    });

    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleCache = new Azure.Redis.Cache("exampleCache", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        Capacity = 1,
        Family = "P",
        SkuName = "Premium",
        EnableNonSslPort = false,
        RedisConfiguration = new Azure.Redis.Inputs.CacheRedisConfigurationArgs
        {
            MaxmemoryReserved = 2,
            MaxmemoryDelta = 2,
            MaxmemoryPolicy = "allkeys-lru",
        },
    });

    var exampleFirewallRule = new Azure.Redis.FirewallRule("exampleFirewallRule", new()
    {
        RedisCacheName = exampleCache.Name,
        ResourceGroupName = exampleResourceGroup.Name,
        StartIp = "1.2.3.4",
        EndIp = "2.3.4.5",
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/redis"
	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := random.NewRandomId(ctx, "server", &random.RandomIdArgs{
			Keepers: pulumi.AnyMap{
				"azi_id": pulumi.Any(1),
			},
			ByteLength: pulumi.Int(8),
		})
		if err != nil {
			return err
		}
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleCache, err := redis.NewCache(ctx, "exampleCache", &redis.CacheArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			Capacity:          pulumi.Int(1),
			Family:            pulumi.String("P"),
			SkuName:           pulumi.String("Premium"),
			EnableNonSslPort:  pulumi.Bool(false),
			RedisConfiguration: &redis.CacheRedisConfigurationArgs{
				MaxmemoryReserved: pulumi.Int(2),
				MaxmemoryDelta:    pulumi.Int(2),
				MaxmemoryPolicy:   pulumi.String("allkeys-lru"),
			},
		})
		if err != nil {
			return err
		}
		_, err = redis.NewFirewallRule(ctx, "exampleFirewallRule", &redis.FirewallRuleArgs{
			RedisCacheName:    exampleCache.Name,
			ResourceGroupName: exampleResourceGroup.Name,
			StartIp:           pulumi.String("1.2.3.4"),
			EndIp:             pulumi.String("2.3.4.5"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomId;
import com.pulumi.random.RandomIdArgs;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.redis.Cache;
import com.pulumi.azure.redis.CacheArgs;
import com.pulumi.azure.redis.inputs.CacheRedisConfigurationArgs;
import com.pulumi.azure.redis.FirewallRule;
import com.pulumi.azure.redis.FirewallRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var server = new RandomId("server", RandomIdArgs.builder()        
            .keepers(Map.of("azi_id", 1))
            .byteLength(8)
            .build());

        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleCache = new Cache("exampleCache", CacheArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .capacity(1)
            .family("P")
            .skuName("Premium")
            .enableNonSslPort(false)
            .redisConfiguration(CacheRedisConfigurationArgs.builder()
                .maxmemoryReserved(2)
                .maxmemoryDelta(2)
                .maxmemoryPolicy("allkeys-lru")
                .build())
            .build());

        var exampleFirewallRule = new FirewallRule("exampleFirewallRule", FirewallRuleArgs.builder()        
            .redisCacheName(exampleCache.name())
            .resourceGroupName(exampleResourceGroup.name())
            .startIp("1.2.3.4")
            .endIp("2.3.4.5")
            .build());

    }
}
import pulumi
import pulumi_azure as azure
import pulumi_random as random

server = random.RandomId("server",
    keepers={
        "azi_id": 1,
    },
    byte_length=8)
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_cache = azure.redis.Cache("exampleCache",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    capacity=1,
    family="P",
    sku_name="Premium",
    enable_non_ssl_port=False,
    redis_configuration=azure.redis.CacheRedisConfigurationArgs(
        maxmemory_reserved=2,
        maxmemory_delta=2,
        maxmemory_policy="allkeys-lru",
    ))
example_firewall_rule = azure.redis.FirewallRule("exampleFirewallRule",
    redis_cache_name=example_cache.name,
    resource_group_name=example_resource_group.name,
    start_ip="1.2.3.4",
    end_ip="2.3.4.5")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as random from "@pulumi/random";

const server = new random.RandomId("server", {
    keepers: {
        azi_id: 1,
    },
    byteLength: 8,
});
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleCache = new azure.redis.Cache("exampleCache", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    capacity: 1,
    family: "P",
    skuName: "Premium",
    enableNonSslPort: false,
    redisConfiguration: {
        maxmemoryReserved: 2,
        maxmemoryDelta: 2,
        maxmemoryPolicy: "allkeys-lru",
    },
});
const exampleFirewallRule = new azure.redis.FirewallRule("exampleFirewallRule", {
    redisCacheName: exampleCache.name,
    resourceGroupName: exampleResourceGroup.name,
    startIp: "1.2.3.4",
    endIp: "2.3.4.5",
});
resources:
  server:
    type: random:RandomId
    properties:
      keepers:
        azi_id: 1
      byteLength: 8
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleCache:
    type: azure:redis:Cache
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      capacity: 1
      family: P
      skuName: Premium
      enableNonSslPort: false
      redisConfiguration:
        maxmemoryReserved: 2
        maxmemoryDelta: 2
        maxmemoryPolicy: allkeys-lru
  exampleFirewallRule:
    type: azure:redis:FirewallRule
    properties:
      redisCacheName: ${exampleCache.name}
      resourceGroupName: ${exampleResourceGroup.name}
      startIp: 1.2.3.4
      endIp: 2.3.4.5

Create FirewallRule Resource

new FirewallRule(name: string, args: FirewallRuleArgs, opts?: CustomResourceOptions);
@overload
def FirewallRule(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 end_ip: Optional[str] = None,
                 name: Optional[str] = None,
                 redis_cache_name: Optional[str] = None,
                 resource_group_name: Optional[str] = None,
                 start_ip: Optional[str] = None)
@overload
def FirewallRule(resource_name: str,
                 args: FirewallRuleArgs,
                 opts: Optional[ResourceOptions] = None)
func NewFirewallRule(ctx *Context, name string, args FirewallRuleArgs, opts ...ResourceOption) (*FirewallRule, error)
public FirewallRule(string name, FirewallRuleArgs args, CustomResourceOptions? opts = null)
public FirewallRule(String name, FirewallRuleArgs args)
public FirewallRule(String name, FirewallRuleArgs args, CustomResourceOptions options)
type: azure:redis:FirewallRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FirewallRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

FirewallRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The FirewallRule resource accepts the following input properties:

EndIp string

The highest IP address included in the range.

RedisCacheName string

The name of the Redis Cache. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

StartIp string

The lowest IP address included in the range

Name string

The name of the Firewall Rule. Changing this forces a new resource to be created.

EndIp string

The highest IP address included in the range.

RedisCacheName string

The name of the Redis Cache. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

StartIp string

The lowest IP address included in the range

Name string

The name of the Firewall Rule. Changing this forces a new resource to be created.

endIp String

The highest IP address included in the range.

redisCacheName String

The name of the Redis Cache. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

startIp String

The lowest IP address included in the range

name String

The name of the Firewall Rule. Changing this forces a new resource to be created.

endIp string

The highest IP address included in the range.

redisCacheName string

The name of the Redis Cache. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

startIp string

The lowest IP address included in the range

name string

The name of the Firewall Rule. Changing this forces a new resource to be created.

end_ip str

The highest IP address included in the range.

redis_cache_name str

The name of the Redis Cache. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

start_ip str

The lowest IP address included in the range

name str

The name of the Firewall Rule. Changing this forces a new resource to be created.

endIp String

The highest IP address included in the range.

redisCacheName String

The name of the Redis Cache. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

startIp String

The lowest IP address included in the range

name String

The name of the Firewall Rule. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the FirewallRule resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing FirewallRule Resource

Get an existing FirewallRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FirewallRuleState, opts?: CustomResourceOptions): FirewallRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        end_ip: Optional[str] = None,
        name: Optional[str] = None,
        redis_cache_name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        start_ip: Optional[str] = None) -> FirewallRule
func GetFirewallRule(ctx *Context, name string, id IDInput, state *FirewallRuleState, opts ...ResourceOption) (*FirewallRule, error)
public static FirewallRule Get(string name, Input<string> id, FirewallRuleState? state, CustomResourceOptions? opts = null)
public static FirewallRule get(String name, Output<String> id, FirewallRuleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
EndIp string

The highest IP address included in the range.

Name string

The name of the Firewall Rule. Changing this forces a new resource to be created.

RedisCacheName string

The name of the Redis Cache. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

StartIp string

The lowest IP address included in the range

EndIp string

The highest IP address included in the range.

Name string

The name of the Firewall Rule. Changing this forces a new resource to be created.

RedisCacheName string

The name of the Redis Cache. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

StartIp string

The lowest IP address included in the range

endIp String

The highest IP address included in the range.

name String

The name of the Firewall Rule. Changing this forces a new resource to be created.

redisCacheName String

The name of the Redis Cache. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

startIp String

The lowest IP address included in the range

endIp string

The highest IP address included in the range.

name string

The name of the Firewall Rule. Changing this forces a new resource to be created.

redisCacheName string

The name of the Redis Cache. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

startIp string

The lowest IP address included in the range

end_ip str

The highest IP address included in the range.

name str

The name of the Firewall Rule. Changing this forces a new resource to be created.

redis_cache_name str

The name of the Redis Cache. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

start_ip str

The lowest IP address included in the range

endIp String

The highest IP address included in the range.

name String

The name of the Firewall Rule. Changing this forces a new resource to be created.

redisCacheName String

The name of the Redis Cache. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which this Redis Cache exists. Changing this forces a new resource to be created.

startIp String

The lowest IP address included in the range

Import

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

 $ pulumi import azure:redis/firewallRule:FirewallRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/firewallRules/rule1

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.