gcp.storage.AnywhereCache
Explore with Pulumi AI
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],
});
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]))
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
	})
}
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,
        },
    });
});
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(bucket)
                .build());
        var cache = new AnywhereCache("cache", AnywhereCacheArgs.builder()
            .bucket(bucket.name())
            .zone("us-central1-f")
            .ttl("3601s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(destroyWait5000Seconds)
                .build());
    }
}
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}
Create AnywhereCache Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AnywhereCache(name: string, args: AnywhereCacheArgs, opts?: CustomResourceOptions);@overload
def AnywhereCache(resource_name: str,
                  args: AnywhereCacheArgs,
                  opts: Optional[ResourceOptions] = None)
@overload
def AnywhereCache(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  bucket: Optional[str] = None,
                  zone: Optional[str] = None,
                  admission_policy: Optional[str] = None,
                  ttl: Optional[str] = None)func NewAnywhereCache(ctx *Context, name string, args AnywhereCacheArgs, opts ...ResourceOption) (*AnywhereCache, error)public AnywhereCache(string name, AnywhereCacheArgs args, CustomResourceOptions? opts = null)
public AnywhereCache(String name, AnywhereCacheArgs args)
public AnywhereCache(String name, AnywhereCacheArgs args, CustomResourceOptions options)
type: gcp:storage:AnywhereCache
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 AnywhereCacheArgs
- 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 AnywhereCacheArgs
- 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 AnywhereCacheArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AnywhereCacheArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AnywhereCacheArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var anywhereCacheResource = new Gcp.Storage.AnywhereCache("anywhereCacheResource", new()
{
    Bucket = "string",
    Zone = "string",
    AdmissionPolicy = "string",
    Ttl = "string",
});
example, err := storage.NewAnywhereCache(ctx, "anywhereCacheResource", &storage.AnywhereCacheArgs{
	Bucket:          pulumi.String("string"),
	Zone:            pulumi.String("string"),
	AdmissionPolicy: pulumi.String("string"),
	Ttl:             pulumi.String("string"),
})
var anywhereCacheResource = new AnywhereCache("anywhereCacheResource", AnywhereCacheArgs.builder()
    .bucket("string")
    .zone("string")
    .admissionPolicy("string")
    .ttl("string")
    .build());
anywhere_cache_resource = gcp.storage.AnywhereCache("anywhereCacheResource",
    bucket="string",
    zone="string",
    admission_policy="string",
    ttl="string")
const anywhereCacheResource = new gcp.storage.AnywhereCache("anywhereCacheResource", {
    bucket: "string",
    zone: "string",
    admissionPolicy: "string",
    ttl: "string",
});
type: gcp:storage:AnywhereCache
properties:
    admissionPolicy: string
    bucket: string
    ttl: string
    zone: string
AnywhereCache Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AnywhereCache resource accepts the following input properties:
- Bucket string
- A reference to Bucket resource
- Zone string
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- AdmissionPolicy string
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- Ttl string
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- Bucket string
- A reference to Bucket resource
- Zone string
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- AdmissionPolicy string
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- Ttl string
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- bucket String
- A reference to Bucket resource
- zone String
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admissionPolicy String
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- ttl String
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- bucket string
- A reference to Bucket resource
- zone string
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admissionPolicy string
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- ttl string
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- bucket str
- A reference to Bucket resource
- zone str
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admission_policy str
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- ttl str
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- bucket String
- A reference to Bucket resource
- zone String
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admissionPolicy String
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- ttl String
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
Outputs
All input properties are implicitly available as output properties. Additionally, the AnywhereCache resource produces the following output properties:
- AnywhereCache stringId 
- The ID of the Anywhere cache instance.
- CreateTime string
- The creation time of the cache instance in RFC 3339 format.
- Id string
- The provider-assigned unique ID for this managed resource.
- PendingUpdate bool
- True if the cache instance has an active Update long-running operation.
- State string
- The current state of the cache instance.
- UpdateTime string
- The modification time of the cache instance metadata in RFC 3339 format.
- AnywhereCache stringId 
- The ID of the Anywhere cache instance.
- CreateTime string
- The creation time of the cache instance in RFC 3339 format.
- Id string
- The provider-assigned unique ID for this managed resource.
- PendingUpdate bool
- True if the cache instance has an active Update long-running operation.
- State string
- The current state of the cache instance.
- UpdateTime string
- The modification time of the cache instance metadata in RFC 3339 format.
- anywhereCache StringId 
- The ID of the Anywhere cache instance.
- createTime String
- The creation time of the cache instance in RFC 3339 format.
- id String
- The provider-assigned unique ID for this managed resource.
- pendingUpdate Boolean
- True if the cache instance has an active Update long-running operation.
- state String
- The current state of the cache instance.
- updateTime String
- The modification time of the cache instance metadata in RFC 3339 format.
- anywhereCache stringId 
- The ID of the Anywhere cache instance.
- createTime string
- The creation time of the cache instance in RFC 3339 format.
- id string
- The provider-assigned unique ID for this managed resource.
- pendingUpdate boolean
- True if the cache instance has an active Update long-running operation.
- state string
- The current state of the cache instance.
- updateTime string
- The modification time of the cache instance metadata in RFC 3339 format.
- anywhere_cache_ strid 
- The ID of the Anywhere cache instance.
- create_time str
- The creation time of the cache instance in RFC 3339 format.
- id str
- The provider-assigned unique ID for this managed resource.
- pending_update bool
- True if the cache instance has an active Update long-running operation.
- state str
- The current state of the cache instance.
- update_time str
- The modification time of the cache instance metadata in RFC 3339 format.
- anywhereCache StringId 
- The ID of the Anywhere cache instance.
- createTime String
- The creation time of the cache instance in RFC 3339 format.
- id String
- The provider-assigned unique ID for this managed resource.
- pendingUpdate Boolean
- True if the cache instance has an active Update long-running operation.
- state String
- The current state of the cache instance.
- updateTime String
- The modification time of the cache instance metadata in RFC 3339 format.
Look up Existing AnywhereCache Resource
Get an existing AnywhereCache 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?: AnywhereCacheState, opts?: CustomResourceOptions): AnywhereCache@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        admission_policy: Optional[str] = None,
        anywhere_cache_id: Optional[str] = None,
        bucket: Optional[str] = None,
        create_time: Optional[str] = None,
        pending_update: Optional[bool] = None,
        state: Optional[str] = None,
        ttl: Optional[str] = None,
        update_time: Optional[str] = None,
        zone: Optional[str] = None) -> AnywhereCachefunc GetAnywhereCache(ctx *Context, name string, id IDInput, state *AnywhereCacheState, opts ...ResourceOption) (*AnywhereCache, error)public static AnywhereCache Get(string name, Input<string> id, AnywhereCacheState? state, CustomResourceOptions? opts = null)public static AnywhereCache get(String name, Output<String> id, AnywhereCacheState state, CustomResourceOptions options)resources:  _:    type: gcp:storage:AnywhereCache    get:      id: ${id}- 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.
- AdmissionPolicy string
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- AnywhereCache stringId 
- The ID of the Anywhere cache instance.
- Bucket string
- A reference to Bucket resource
- CreateTime string
- The creation time of the cache instance in RFC 3339 format.
- PendingUpdate bool
- True if the cache instance has an active Update long-running operation.
- State string
- The current state of the cache instance.
- Ttl string
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- UpdateTime string
- The modification time of the cache instance metadata in RFC 3339 format.
- Zone string
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- AdmissionPolicy string
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- AnywhereCache stringId 
- The ID of the Anywhere cache instance.
- Bucket string
- A reference to Bucket resource
- CreateTime string
- The creation time of the cache instance in RFC 3339 format.
- PendingUpdate bool
- True if the cache instance has an active Update long-running operation.
- State string
- The current state of the cache instance.
- Ttl string
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- UpdateTime string
- The modification time of the cache instance metadata in RFC 3339 format.
- Zone string
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admissionPolicy String
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- anywhereCache StringId 
- The ID of the Anywhere cache instance.
- bucket String
- A reference to Bucket resource
- createTime String
- The creation time of the cache instance in RFC 3339 format.
- pendingUpdate Boolean
- True if the cache instance has an active Update long-running operation.
- state String
- The current state of the cache instance.
- ttl String
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- updateTime String
- The modification time of the cache instance metadata in RFC 3339 format.
- zone String
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admissionPolicy string
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- anywhereCache stringId 
- The ID of the Anywhere cache instance.
- bucket string
- A reference to Bucket resource
- createTime string
- The creation time of the cache instance in RFC 3339 format.
- pendingUpdate boolean
- True if the cache instance has an active Update long-running operation.
- state string
- The current state of the cache instance.
- ttl string
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- updateTime string
- The modification time of the cache instance metadata in RFC 3339 format.
- zone string
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admission_policy str
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- anywhere_cache_ strid 
- The ID of the Anywhere cache instance.
- bucket str
- A reference to Bucket resource
- create_time str
- The creation time of the cache instance in RFC 3339 format.
- pending_update bool
- True if the cache instance has an active Update long-running operation.
- state str
- The current state of the cache instance.
- ttl str
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- update_time str
- The modification time of the cache instance metadata in RFC 3339 format.
- zone str
- The zone in which the cache instance needs to be created. For example, us-central1-a.
- admissionPolicy String
- The cache admission policy dictates whether a block should be inserted upon a cache miss.
Default value is admit-on-first-miss. Possible values are:admit-on-first-miss,admit-on-second-miss.
- anywhereCache StringId 
- The ID of the Anywhere cache instance.
- bucket String
- A reference to Bucket resource
- createTime String
- The creation time of the cache instance in RFC 3339 format.
- pendingUpdate Boolean
- True if the cache instance has an active Update long-running operation.
- state String
- The current state of the cache instance.
- ttl String
- The TTL of all cache entries in whole seconds. e.g., "7200s". It defaults to 86400s
- updateTime String
- The modification time of the cache instance metadata in RFC 3339 format.
- zone String
- The zone in which the cache instance needs to be created. For example, us-central1-a.
Import
AnywhereCache can be imported using any of these accepted formats:
- b/{{bucket}}/anywhereCaches/{{anywhere_cache_id}}
- {{bucket}}/{{anywhere_cache_id}}
When using the pulumi 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}}
$ pulumi import gcp:storage/anywhereCache:AnywhereCache default {{bucket}}/{{anywhere_cache_id}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the google-betaTerraform Provider.