get Cache
Use this data source to access information about an existing Redis Cache
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.redis.getCache({
name: "myrediscache",
resourceGroupName: "redis-cache",
});
export const primaryAccessKey = example.then(example => example.primaryAccessKey);
export const hostname = example.then(example => example.hostname);
Content copied to clipboard
import pulumi
import pulumi_azure as azure
example = azure.redis.get_cache(name="myrediscache",
resource_group_name="redis-cache")
pulumi.export("primaryAccessKey", example.primary_access_key)
pulumi.export("hostname", example.hostname)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.Redis.GetCache.Invoke(new()
{
Name = "myrediscache",
ResourceGroupName = "redis-cache",
});
return new Dictionary<string, object?>
{
["primaryAccessKey"] = example.Apply(getCacheResult => getCacheResult.PrimaryAccessKey),
["hostname"] = example.Apply(getCacheResult => getCacheResult.Hostname),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/redis"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := redis.LookupCache(ctx, &redis.LookupCacheArgs{
Name: "myrediscache",
ResourceGroupName: "redis-cache",
}, nil)
if err != nil {
return err
}
ctx.Export("primaryAccessKey", example.PrimaryAccessKey)
ctx.Export("hostname", example.Hostname)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.redis.RedisFunctions;
import com.pulumi.azure.redis.inputs.GetCacheArgs;
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) {
final var example = RedisFunctions.getCache(GetCacheArgs.builder()
.name("myrediscache")
.resourceGroupName("redis-cache")
.build());
ctx.export("primaryAccessKey", example.applyValue(getCacheResult -> getCacheResult.primaryAccessKey()));
ctx.export("hostname", example.applyValue(getCacheResult -> getCacheResult.hostname()));
}
}
Content copied to clipboard
variables:
example:
fn::invoke:
function: azure:redis:getCache
arguments:
name: myrediscache
resourceGroupName: redis-cache
outputs:
primaryAccessKey: ${example.primaryAccessKey}
hostname: ${example.hostname}
Content copied to clipboard
Return
A collection of values returned by getCache.
Parameters
argument
A collection of arguments for invoking getCache.
Return
A collection of values returned by getCache.
Parameters
name
The name of the Redis cache
resource Group Name
The name of the resource group the Redis cache instance is located in.
See also
Return
A collection of values returned by getCache.
Parameters
argument
Builder for com.pulumi.azure.redis.kotlin.inputs.GetCachePlainArgs.