1. Packages
  2. Azure Classic
  3. API Docs
  4. redis
  5. CacheAccessPolicy

We recommend using Azure Native.

Azure Classic v5.78.0 published on Wednesday, May 22, 2024 by Pulumi

azure.redis.CacheAccessPolicy

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.78.0 published on Wednesday, May 22, 2024 by Pulumi

    Manages a Redis Cache Access Policy

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "East US",
    });
    const exampleCache = new azure.redis.Cache("example", {
        name: "example",
        location: example.location,
        resourceGroupName: example.name,
        capacity: 1,
        family: "P",
        skuName: "Premium",
        enableNonSslPort: false,
        redisConfiguration: {
            maxmemoryReserved: 2,
            maxmemoryDelta: 2,
            maxmemoryPolicy: "allkeys-lru",
        },
    });
    const exampleCacheAccessPolicy = new azure.redis.CacheAccessPolicy("example", {
        name: "example",
        redisCacheId: exampleCache.id,
        permissions: "+@read +@connection +cluster|info",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="East US")
    example_cache = azure.redis.Cache("example",
        name="example",
        location=example.location,
        resource_group_name=example.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_cache_access_policy = azure.redis.CacheAccessPolicy("example",
        name="example",
        redis_cache_id=example_cache.id,
        permissions="+@read +@connection +cluster|info")
    
    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/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("East US"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleCache, err := redis.NewCache(ctx, "example", &redis.CacheArgs{
    			Name:              pulumi.String("example"),
    			Location:          example.Location,
    			ResourceGroupName: example.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.NewCacheAccessPolicy(ctx, "example", &redis.CacheAccessPolicyArgs{
    			Name:         pulumi.String("example"),
    			RedisCacheId: exampleCache.ID(),
    			Permissions:  pulumi.String("+@read +@connection +cluster|info"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "East US",
        });
    
        var exampleCache = new Azure.Redis.Cache("example", new()
        {
            Name = "example",
            Location = example.Location,
            ResourceGroupName = example.Name,
            Capacity = 1,
            Family = "P",
            SkuName = "Premium",
            EnableNonSslPort = false,
            RedisConfiguration = new Azure.Redis.Inputs.CacheRedisConfigurationArgs
            {
                MaxmemoryReserved = 2,
                MaxmemoryDelta = 2,
                MaxmemoryPolicy = "allkeys-lru",
            },
        });
    
        var exampleCacheAccessPolicy = new Azure.Redis.CacheAccessPolicy("example", new()
        {
            Name = "example",
            RedisCacheId = exampleCache.Id,
            Permissions = "+@read +@connection +cluster|info",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    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.CacheAccessPolicy;
    import com.pulumi.azure.redis.CacheAccessPolicyArgs;
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()        
                .name("example-resources")
                .location("East US")
                .build());
    
            var exampleCache = new Cache("exampleCache", CacheArgs.builder()        
                .name("example")
                .location(example.location())
                .resourceGroupName(example.name())
                .capacity(1)
                .family("P")
                .skuName("Premium")
                .enableNonSslPort(false)
                .redisConfiguration(CacheRedisConfigurationArgs.builder()
                    .maxmemoryReserved(2)
                    .maxmemoryDelta(2)
                    .maxmemoryPolicy("allkeys-lru")
                    .build())
                .build());
    
            var exampleCacheAccessPolicy = new CacheAccessPolicy("exampleCacheAccessPolicy", CacheAccessPolicyArgs.builder()        
                .name("example")
                .redisCacheId(exampleCache.id())
                .permissions("+@read +@connection +cluster|info")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: East US
      exampleCache:
        type: azure:redis:Cache
        name: example
        properties:
          name: example
          location: ${example.location}
          resourceGroupName: ${example.name}
          capacity: 1
          family: P
          skuName: Premium
          enableNonSslPort: false
          redisConfiguration:
            maxmemoryReserved: 2
            maxmemoryDelta: 2
            maxmemoryPolicy: allkeys-lru
      exampleCacheAccessPolicy:
        type: azure:redis:CacheAccessPolicy
        name: example
        properties:
          name: example
          redisCacheId: ${exampleCache.id}
          permissions: +@read +@connection +cluster|info
    

    Create CacheAccessPolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

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

    Parameters

    name string
    The unique name of the resource.
    args CacheAccessPolicyArgs
    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 CacheAccessPolicyArgs
    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 CacheAccessPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CacheAccessPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CacheAccessPolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var azureCacheAccessPolicyResource = new Azure.Redis.CacheAccessPolicy("azureCacheAccessPolicyResource", new()
    {
        Permissions = "string",
        RedisCacheId = "string",
        Name = "string",
    });
    
    example, err := redis.NewCacheAccessPolicy(ctx, "azureCacheAccessPolicyResource", &redis.CacheAccessPolicyArgs{
    	Permissions:  pulumi.String("string"),
    	RedisCacheId: pulumi.String("string"),
    	Name:         pulumi.String("string"),
    })
    
    var azureCacheAccessPolicyResource = new CacheAccessPolicy("azureCacheAccessPolicyResource", CacheAccessPolicyArgs.builder()        
        .permissions("string")
        .redisCacheId("string")
        .name("string")
        .build());
    
    azure_cache_access_policy_resource = azure.redis.CacheAccessPolicy("azureCacheAccessPolicyResource",
        permissions="string",
        redis_cache_id="string",
        name="string")
    
    const azureCacheAccessPolicyResource = new azure.redis.CacheAccessPolicy("azureCacheAccessPolicyResource", {
        permissions: "string",
        redisCacheId: "string",
        name: "string",
    });
    
    type: azure:redis:CacheAccessPolicy
    properties:
        name: string
        permissions: string
        redisCacheId: string
    

    CacheAccessPolicy 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 CacheAccessPolicy resource accepts the following input properties:

    Permissions string
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    Name string
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    Permissions string
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    Name string
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions String
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name String
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions string
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name string
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions str
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redis_cache_id str
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name str
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions String
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name String
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CacheAccessPolicy 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 CacheAccessPolicy Resource

    Get an existing CacheAccessPolicy 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?: CacheAccessPolicyState, opts?: CustomResourceOptions): CacheAccessPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            permissions: Optional[str] = None,
            redis_cache_id: Optional[str] = None) -> CacheAccessPolicy
    func GetCacheAccessPolicy(ctx *Context, name string, id IDInput, state *CacheAccessPolicyState, opts ...ResourceOption) (*CacheAccessPolicy, error)
    public static CacheAccessPolicy Get(string name, Input<string> id, CacheAccessPolicyState? state, CustomResourceOptions? opts = null)
    public static CacheAccessPolicy get(String name, Output<String> id, CacheAccessPolicyState 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:
    Name string
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    Permissions string
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    Name string
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    Permissions string
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    RedisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name String
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions String
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name string
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions string
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redisCacheId string
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name str
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions str
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redis_cache_id str
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.
    name String
    The name of the Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    permissions String
    Permissions that are going to be assigned to this Redis Cache Access Policy. Changing this forces a new Redis Cache Access Policy to be created.
    redisCacheId String
    The ID of the Redis Cache. Changing this forces a new Redis Cache Access Policy to be created.

    Import

    Redis Cache Access Policy can be imported using the resource id, e.g.

    $ pulumi import azure:redis/cacheAccessPolicy:CacheAccessPolicy example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Cache/redis/cache1/accessPolicies/policy1
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.78.0 published on Wednesday, May 22, 2024 by Pulumi