Anywhere Cache Args
data class AnywhereCacheArgs(val admissionPolicy: Output<String>? = null, val bucket: Output<String>? = null, val ttl: Output<String>? = null, val zone: Output<String>? = null) : ConvertibleToJava<AnywhereCacheArgs>
The Google Cloud Storage (GCS) Anywhere Cache feature allows users to create SSD backed zonal read cache for their buckets. These zonal caches are co-located with the customers compute engines to provide cost efficiency.
Example Usage
Storage Anywhere Cache Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumi/time";
const bucket = new gcp.storage.Bucket("bucket", {
name: "bucket-name",
location: "US",
});
const destroyWait5000Seconds = new time.index.Sleep("destroy_wait_5000_seconds", {destroyDuration: "5000s"}, {
dependsOn: [bucket],
});
const cache = new gcp.storage.AnywhereCache("cache", {
bucket: bucket.name,
zone: "us-central1-f",
ttl: "3601s",
}, {
dependsOn: [destroyWait5000Seconds],
});
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
import pulumi_time as time
bucket = gcp.storage.Bucket("bucket",
name="bucket-name",
location="US")
destroy_wait5000_seconds = time.index.Sleep("destroy_wait_5000_seconds", destroy_duration=5000s,
opts = pulumi.ResourceOptions(depends_on=[bucket]))
cache = gcp.storage.AnywhereCache("cache",
bucket=bucket.name,
zone="us-central1-f",
ttl="3601s",
opts = pulumi.ResourceOptions(depends_on=[destroy_wait5000_seconds]))
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumi.Time;
return await Deployment.RunAsync(() =>
{
var bucket = new Gcp.Storage.Bucket("bucket", new()
{
Name = "bucket-name",
Location = "US",
});
var destroyWait5000Seconds = new Time.Index.Sleep("destroy_wait_5000_seconds", new()
{
DestroyDuration = "5000s",
}, new CustomResourceOptions
{
DependsOn =
{
bucket,
},
});
var cache = new Gcp.Storage.AnywhereCache("cache", new()
{
Bucket = bucket.Name,
Zone = "us-central1-f",
Ttl = "3601s",
}, new CustomResourceOptions
{
DependsOn =
{
destroyWait5000Seconds,
},
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/storage"
"github.com/pulumi/pulumi-time/sdk/go/time"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
Name: pulumi.String("bucket-name"),
Location: pulumi.String("US"),
})
if err != nil {
return err
}
destroyWait5000Seconds, err := time.NewSleep(ctx, "destroy_wait_5000_seconds", &time.SleepArgs{
DestroyDuration: "5000s",
}, pulumi.DependsOn([]pulumi.Resource{
bucket,
}))
if err != nil {
return err
}
_, err = storage.NewAnywhereCache(ctx, "cache", &storage.AnywhereCacheArgs{
Bucket: bucket.Name,
Zone: pulumi.String("us-central1-f"),
Ttl: pulumi.String("3601s"),
}, pulumi.DependsOn([]pulumi.Resource{
destroyWait5000Seconds,
}))
if err != nil {
return err
}
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.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.time.sleep;
import com.pulumi.time.sleepArgs;
import com.pulumi.gcp.storage.AnywhereCache;
import com.pulumi.gcp.storage.AnywhereCacheArgs;
import com.pulumi.resources.CustomResourceOptions;
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 bucket = new Bucket("bucket", BucketArgs.builder()
.name("bucket-name")
.location("US")
.build());
var destroyWait5000Seconds = new Sleep("destroyWait5000Seconds", SleepArgs.builder()
.destroyDuration("5000s")
.build(), CustomResourceOptions.builder()
.dependsOn(List.of(bucket))
.build());
var cache = new AnywhereCache("cache", AnywhereCacheArgs.builder()
.bucket(bucket.name())
.zone("us-central1-f")
.ttl("3601s")
.build(), CustomResourceOptions.builder()
.dependsOn(destroyWait5000Seconds)
.build());
}
}
Content copied to clipboard
resources:
bucket:
type: gcp:storage:Bucket
properties:
name: bucket-name
location: US
destroyWait5000Seconds:
type: time:sleep
name: destroy_wait_5000_seconds
properties:
destroyDuration: 5000s
options:
dependsOn:
- ${bucket}
cache:
type: gcp:storage:AnywhereCache
properties:
bucket: ${bucket.name}
zone: us-central1-f
ttl: 3601s
options:
dependsOn:
- ${destroyWait5000Seconds}
Content copied to clipboard
Import
AnywhereCache can be imported using any of these accepted formats:
b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}
{{bucket}}/{{anywhere_cache_id}}
When using thepulumi import
command, AnywhereCache can be imported using one of the formats above. For example:
$ pulumi import gcp:storage/anywhereCache:AnywhereCache default b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}
Content copied to clipboard
$ pulumi import gcp:storage/anywhereCache:AnywhereCache default {{bucket}}/{{anywhere_cache_id}}
Content copied to clipboard