@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
316 lines (315 loc) • 10.5 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A `Version` is a configuration which determine how a site is displayed. Static files are not supported at the moment.
*
* To get more information about Version, see:
*
* * [API documentation](https://firebase.google.com/docs/reference/hosting/rest/v1beta1/sites.versions)
* * How-to Guides
* * [Official Documentation](https://firebase.google.com/docs/hosting)
*
* ## Example Usage
*
* ### Firebasehosting Version Redirect
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.firebase.HostingSite("default", {
* project: "my-project-name",
* siteId: "site-id",
* });
* const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
* siteId: _default.siteId,
* config: {
* redirects: [{
* glob: "/google/**",
* statusCode: 302,
* location: "https://www.google.com",
* }],
* },
* });
* const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
* siteId: _default.siteId,
* versionName: defaultHostingVersion.name,
* message: "Redirect to Google",
* });
* ```
* ### Firebasehosting Version Headers
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.firebase.HostingSite("default", {
* project: "my-project-name",
* siteId: "site-id",
* });
* const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
* siteId: _default.siteId,
* config: {
* headers: [{
* glob: "/headers/**",
* headers: {
* "my-header": "my-value",
* },
* }],
* },
* });
* const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
* siteId: _default.siteId,
* versionName: defaultHostingVersion.name,
* message: "With custom headers",
* });
* ```
* ### Firebasehosting Version Headers Regex
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.firebase.HostingSite("default", {
* project: "my-project-name",
* siteId: "site-id",
* });
* const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
* siteId: _default.siteId,
* config: {
* headers: [{
* regex: "^~/headers$",
* headers: {
* "my-header": "my-value",
* },
* }],
* },
* });
* const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
* siteId: _default.siteId,
* versionName: defaultHostingVersion.name,
* message: "With custom headers",
* });
* ```
* ### Firebasehosting Version Path
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.firebase.HostingSite("default", {
* project: "my-project-name",
* siteId: "site-id",
* });
* const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
* siteId: _default.siteId,
* config: {
* rewrites: [{
* glob: "**",
* path: "/index.html",
* }],
* },
* });
* const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
* siteId: _default.siteId,
* versionName: defaultHostingVersion.name,
* message: "Path Rewrite",
* });
* ```
* ### Firebasehosting Version Cloud Run
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.firebase.HostingSite("default", {
* project: "my-project-name",
* siteId: "site-id",
* });
* const defaultService = new gcp.cloudrunv2.Service("default", {
* project: "my-project-name",
* name: "cloud-run-service-via-hosting",
* location: "us-central1",
* ingress: "INGRESS_TRAFFIC_ALL",
* template: {
* containers: [{
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* }],
* },
* deletionProtection: true,
* });
* const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
* siteId: _default.siteId,
* config: {
* rewrites: [{
* glob: "/hello/**",
* run: {
* serviceId: defaultService.name,
* region: defaultService.location,
* },
* }],
* },
* });
* const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
* siteId: _default.siteId,
* versionName: defaultHostingVersion.name,
* message: "Cloud Run Integration",
* });
* ```
* ### Firebasehosting Version Cloud Functions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.firebase.HostingSite("default", {
* project: "my-project-name",
* siteId: "site-id",
* });
* const bucket = new gcp.storage.Bucket("bucket", {
* project: "my-project-name",
* name: "site-id-function-source",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const object = new gcp.storage.BucketObject("object", {
* name: "function-source.zip",
* bucket: bucket.name,
* source: new pulumi.asset.FileAsset("function-source.zip"),
* });
* const _function = new gcp.cloudfunctionsv2.Function("function", {
* project: "my-project-name",
* name: "cloud-function-via-hosting",
* location: "us-central1",
* description: "A Cloud Function connected to Firebase Hosing",
* buildConfig: {
* runtime: "nodejs22",
* entryPoint: "helloHttp",
* source: {
* storageSource: {
* bucket: bucket.name,
* object: object.name,
* },
* },
* },
* serviceConfig: {
* maxInstanceCount: 1,
* availableMemory: "256M",
* timeoutSeconds: 60,
* },
* });
* const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
* siteId: _default.siteId,
* config: {
* rewrites: [{
* glob: "/hello/**",
* "function": _function.name,
* }],
* },
* });
* const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
* siteId: _default.siteId,
* versionName: defaultHostingVersion.name,
* message: "Cloud Functions Integration",
* });
* ```
*
* ## Import
*
* Version can be imported using any of these accepted formats:
*
* * `sites/{{site_id}}/versions/{{version_id}}`
*
* * `{{site_id}}/{{version_id}}`
*
* When using the `pulumi import` command, Version can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:firebase/hostingVersion:HostingVersion default sites/{{site_id}}/versions/{{version_id}}
* ```
*
* ```sh
* $ pulumi import gcp:firebase/hostingVersion:HostingVersion default {{site_id}}/{{version_id}}
* ```
*/
export declare class HostingVersion extends pulumi.CustomResource {
/**
* Get an existing HostingVersion 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?: HostingVersionState, opts?: pulumi.CustomResourceOptions): HostingVersion;
/**
* Returns true if the given object is an instance of HostingVersion. 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 HostingVersion;
/**
* The configuration for the behavior of the site. This configuration exists in the `firebase.json` file.
* Structure is documented below.
*/
readonly config: pulumi.Output<outputs.firebase.HostingVersionConfig | undefined>;
/**
* The fully-qualified resource name for the version, in the format:
* sites/SITE_ID/versions/VERSION_ID
*/
readonly name: pulumi.Output<string>;
/**
* Required. The ID of the site in which to create this Version.
*/
readonly siteId: pulumi.Output<string>;
/**
* The ID for the version as in sites/SITE_ID/versions/VERSION_ID
*/
readonly versionId: pulumi.Output<string>;
/**
* Create a HostingVersion 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: HostingVersionArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering HostingVersion resources.
*/
export interface HostingVersionState {
/**
* The configuration for the behavior of the site. This configuration exists in the `firebase.json` file.
* Structure is documented below.
*/
config?: pulumi.Input<inputs.firebase.HostingVersionConfig>;
/**
* The fully-qualified resource name for the version, in the format:
* sites/SITE_ID/versions/VERSION_ID
*/
name?: pulumi.Input<string>;
/**
* Required. The ID of the site in which to create this Version.
*/
siteId?: pulumi.Input<string>;
/**
* The ID for the version as in sites/SITE_ID/versions/VERSION_ID
*/
versionId?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a HostingVersion resource.
*/
export interface HostingVersionArgs {
/**
* The configuration for the behavior of the site. This configuration exists in the `firebase.json` file.
* Structure is documented below.
*/
config?: pulumi.Input<inputs.firebase.HostingVersionConfig>;
/**
* Required. The ID of the site in which to create this Version.
*/
siteId: pulumi.Input<string>;
}