UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

358 lines (357 loc) • 13.9 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Backend buckets allow you to use Google Cloud Storage buckets with HTTP(S) * load balancing. * * An HTTP(S) load balancer can direct traffic to specified URLs to a * backend bucket rather than a backend service. It can send requests for * static content to a Cloud Storage bucket and requests for dynamic content * to a virtual machine instance. * * To get more information about BackendBucket, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/v1/backendBuckets) * * How-to Guides * * [Using a Cloud Storage bucket as a load balancer backend](https://cloud.google.com/compute/docs/load-balancing/http/backend-bucket) * * ## Example Usage * * ### Backend Bucket Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const imageBucket = new gcp.storage.Bucket("image_bucket", { * name: "image-store-bucket", * location: "EU", * }); * const imageBackend = new gcp.compute.BackendBucket("image_backend", { * name: "image-backend-bucket", * description: "Contains beautiful images", * bucketName: imageBucket.name, * enableCdn: true, * }); * ``` * ### Backend Bucket Security Policy * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const imageBackendBucket = new gcp.storage.Bucket("image_backend", { * name: "image-store-bucket", * location: "EU", * }); * const policy = new gcp.compute.SecurityPolicy("policy", { * name: "image-store-bucket", * description: "basic security policy", * type: "CLOUD_ARMOR_EDGE", * }); * const imageBackend = new gcp.compute.BackendBucket("image_backend", { * name: "image-backend-bucket", * description: "Contains beautiful images", * bucketName: imageBackendBucket.name, * enableCdn: true, * edgeSecurityPolicy: policy.id, * }); * ``` * ### Backend Bucket Query String Whitelist * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const imageBucket = new gcp.storage.Bucket("image_bucket", { * name: "image-backend-bucket", * location: "EU", * }); * const imageBackend = new gcp.compute.BackendBucket("image_backend", { * name: "image-backend-bucket", * description: "Contains beautiful images", * bucketName: imageBucket.name, * enableCdn: true, * cdnPolicy: { * cacheKeyPolicy: { * queryStringWhitelists: ["image-version"], * }, * }, * }); * ``` * ### Backend Bucket Include Http Headers * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const imageBucket = new gcp.storage.Bucket("image_bucket", { * name: "image-backend-bucket", * location: "EU", * }); * const imageBackend = new gcp.compute.BackendBucket("image_backend", { * name: "image-backend-bucket", * description: "Contains beautiful images", * bucketName: imageBucket.name, * enableCdn: true, * cdnPolicy: { * cacheKeyPolicy: { * includeHttpHeaders: ["X-My-Header-Field"], * }, * }, * }); * ``` * * ## Import * * BackendBucket can be imported using any of these accepted formats: * * * `projects/{{project}}/global/backendBuckets/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, BackendBucket can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/backendBucket:BackendBucket default projects/{{project}}/global/backendBuckets/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/backendBucket:BackendBucket default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/backendBucket:BackendBucket default {{name}} * ``` */ export declare class BackendBucket extends pulumi.CustomResource { /** * Get an existing BackendBucket resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: BackendBucketState, opts?: pulumi.CustomResourceOptions): BackendBucket; /** * Returns true if the given object is an instance of BackendBucket. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is BackendBucket; /** * Cloud Storage bucket name. */ readonly bucketName: pulumi.Output<string>; /** * Cloud CDN configuration for this Backend Bucket. * Structure is documented below. */ readonly cdnPolicy: pulumi.Output<outputs.compute.BackendBucketCdnPolicy>; /** * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header. * Possible values are: `AUTOMATIC`, `DISABLED`. */ readonly compressionMode: pulumi.Output<string | undefined>; /** * Creation timestamp in RFC3339 text format. */ readonly creationTimestamp: pulumi.Output<string>; /** * Headers that the HTTP/S load balancer should add to proxied responses. */ readonly customResponseHeaders: pulumi.Output<string[] | undefined>; /** * An optional textual description of the resource; provided by the * client when the resource is created. */ readonly description: pulumi.Output<string | undefined>; /** * The security policy associated with this backend bucket. */ readonly edgeSecurityPolicy: pulumi.Output<string | undefined>; /** * If true, enable Cloud CDN for this BackendBucket. * Note: This cannot be set to true when loadBalancingScheme is set to INTERNAL_MANAGED. */ readonly enableCdn: pulumi.Output<boolean | undefined>; /** * The value can only be INTERNAL_MANAGED for cross-region internal layer 7 load balancer. * If loadBalancingScheme is not specified, the backend bucket can be used by classic global external load balancers, or global application external load balancers, or both. * Important: CDN cannot be enabled (enableCdn cannot be set to true) when loadBalancingScheme is set to INTERNAL_MANAGED. * Possible values are: `INTERNAL_MANAGED`. */ readonly loadBalancingScheme: pulumi.Output<string | undefined>; /** * Name of the resource. Provided by the client when the resource is * created. The name must be 1-63 characters long, and comply with * RFC1035. Specifically, the name must be 1-63 characters long and * match the regular expression `a-z?` which means * the first character must be a lowercase letter, and all following * characters must be a dash, lowercase letter, or digit, except the * last character, which cannot be a dash. */ readonly name: pulumi.Output<string>; /** * Additional params passed with the request, but not persisted as part of resource payload * Structure is documented below. */ readonly params: pulumi.Output<outputs.compute.BackendBucketParams | undefined>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output<string>; /** * Create a BackendBucket resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: BackendBucketArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering BackendBucket resources. */ export interface BackendBucketState { /** * Cloud Storage bucket name. */ bucketName?: pulumi.Input<string>; /** * Cloud CDN configuration for this Backend Bucket. * Structure is documented below. */ cdnPolicy?: pulumi.Input<inputs.compute.BackendBucketCdnPolicy>; /** * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header. * Possible values are: `AUTOMATIC`, `DISABLED`. */ compressionMode?: pulumi.Input<string>; /** * Creation timestamp in RFC3339 text format. */ creationTimestamp?: pulumi.Input<string>; /** * Headers that the HTTP/S load balancer should add to proxied responses. */ customResponseHeaders?: pulumi.Input<pulumi.Input<string>[]>; /** * An optional textual description of the resource; provided by the * client when the resource is created. */ description?: pulumi.Input<string>; /** * The security policy associated with this backend bucket. */ edgeSecurityPolicy?: pulumi.Input<string>; /** * If true, enable Cloud CDN for this BackendBucket. * Note: This cannot be set to true when loadBalancingScheme is set to INTERNAL_MANAGED. */ enableCdn?: pulumi.Input<boolean>; /** * The value can only be INTERNAL_MANAGED for cross-region internal layer 7 load balancer. * If loadBalancingScheme is not specified, the backend bucket can be used by classic global external load balancers, or global application external load balancers, or both. * Important: CDN cannot be enabled (enableCdn cannot be set to true) when loadBalancingScheme is set to INTERNAL_MANAGED. * Possible values are: `INTERNAL_MANAGED`. */ loadBalancingScheme?: pulumi.Input<string>; /** * Name of the resource. Provided by the client when the resource is * created. The name must be 1-63 characters long, and comply with * RFC1035. Specifically, the name must be 1-63 characters long and * match the regular expression `a-z?` which means * the first character must be a lowercase letter, and all following * characters must be a dash, lowercase letter, or digit, except the * last character, which cannot be a dash. */ name?: pulumi.Input<string>; /** * Additional params passed with the request, but not persisted as part of resource payload * Structure is documented below. */ params?: pulumi.Input<inputs.compute.BackendBucketParams>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The URI of the created resource. */ selfLink?: pulumi.Input<string>; } /** * The set of arguments for constructing a BackendBucket resource. */ export interface BackendBucketArgs { /** * Cloud Storage bucket name. */ bucketName: pulumi.Input<string>; /** * Cloud CDN configuration for this Backend Bucket. * Structure is documented below. */ cdnPolicy?: pulumi.Input<inputs.compute.BackendBucketCdnPolicy>; /** * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header. * Possible values are: `AUTOMATIC`, `DISABLED`. */ compressionMode?: pulumi.Input<string>; /** * Headers that the HTTP/S load balancer should add to proxied responses. */ customResponseHeaders?: pulumi.Input<pulumi.Input<string>[]>; /** * An optional textual description of the resource; provided by the * client when the resource is created. */ description?: pulumi.Input<string>; /** * The security policy associated with this backend bucket. */ edgeSecurityPolicy?: pulumi.Input<string>; /** * If true, enable Cloud CDN for this BackendBucket. * Note: This cannot be set to true when loadBalancingScheme is set to INTERNAL_MANAGED. */ enableCdn?: pulumi.Input<boolean>; /** * The value can only be INTERNAL_MANAGED for cross-region internal layer 7 load balancer. * If loadBalancingScheme is not specified, the backend bucket can be used by classic global external load balancers, or global application external load balancers, or both. * Important: CDN cannot be enabled (enableCdn cannot be set to true) when loadBalancingScheme is set to INTERNAL_MANAGED. * Possible values are: `INTERNAL_MANAGED`. */ loadBalancingScheme?: pulumi.Input<string>; /** * Name of the resource. Provided by the client when the resource is * created. The name must be 1-63 characters long, and comply with * RFC1035. Specifically, the name must be 1-63 characters long and * match the regular expression `a-z?` which means * the first character must be a lowercase letter, and all following * characters must be a dash, lowercase letter, or digit, except the * last character, which cannot be a dash. */ name?: pulumi.Input<string>; /** * Additional params passed with the request, but not persisted as part of resource payload * Structure is documented below. */ params?: pulumi.Input<inputs.compute.BackendBucketParams>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; }