@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
348 lines (347 loc) • 12.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Controls traffic configuration for a backend.
*
* ## Example Usage
*
* ### Firebase App Hosting Traffic Target
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* //## Include these blocks only once per project if you are starting from scratch ###
* const serviceAccount = new gcp.serviceaccount.Account("service_account", {
* project: "my-project-name",
* accountId: "firebase-app-hosting-compute",
* displayName: "Firebase App Hosting compute service account",
* createIgnoreAlreadyExists: true,
* });
* const fah = new gcp.projects.Service("fah", {
* project: "my-project-name",
* service: "firebaseapphosting.googleapis.com",
* });
* const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", {
* project: "my-project-name",
* location: "asia-east1",
* backendId: "traffic-tg",
* appId: "1:0000000000:web:674cde32020e16fbce9dbd",
* servingLocality: "GLOBAL_ACCESS",
* serviceAccount: serviceAccount.email,
* }, {
* dependsOn: [fah],
* });
* const exampleAppHostingBuild = new gcp.firebase.AppHostingBuild("example", {
* project: exampleAppHostingBackend.project,
* location: exampleAppHostingBackend.location,
* backend: exampleAppHostingBackend.backendId,
* buildId: "target-build",
* source: {
* container: {
* image: "us-docker.pkg.dev/cloudrun/container/hello",
* },
* },
* });
* const example = new gcp.firebase.AppHostingTraffic("example", {
* project: exampleAppHostingBackend.project,
* location: exampleAppHostingBackend.location,
* backend: exampleAppHostingBackend.backendId,
* target: {
* splits: [{
* build: exampleAppHostingBuild.name,
* percent: 100,
* }],
* },
* });
* const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
* project: "my-project-name",
* role: "roles/firebaseapphosting.computeRunner",
* member: serviceAccount.member,
* });
* ```
* ### Firebase App Hosting Traffic Rollout Policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* //## Include these blocks only once per project if you are starting from scratch ###
* const serviceAccount = new gcp.serviceaccount.Account("service_account", {
* project: "my-project-name",
* accountId: "firebase-app-hosting-compute",
* displayName: "Firebase App Hosting compute service account",
* createIgnoreAlreadyExists: true,
* });
* const fah = new gcp.projects.Service("fah", {
* project: "my-project-name",
* service: "firebaseapphosting.googleapis.com",
* });
* const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", {
* project: "my-project-name",
* location: "asia-east1",
* backendId: "traffic-rp",
* appId: "1:0000000000:web:674cde32020e16fbce9dbd",
* servingLocality: "GLOBAL_ACCESS",
* serviceAccount: serviceAccount.email,
* }, {
* dependsOn: [fah],
* });
* const example = new gcp.firebase.AppHostingTraffic("example", {
* project: exampleAppHostingBackend.project,
* location: exampleAppHostingBackend.location,
* backend: exampleAppHostingBackend.backendId,
* rolloutPolicy: {
* codebaseBranch: "main",
* },
* });
* const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
* project: "my-project-name",
* role: "roles/firebaseapphosting.computeRunner",
* member: serviceAccount.member,
* });
* ```
* ### Firebase App Hosting Traffic Rollout Policy Disabled
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* //## Include these blocks only once per project if you are starting from scratch ###
* const serviceAccount = new gcp.serviceaccount.Account("service_account", {
* project: "my-project-name",
* accountId: "firebase-app-hosting-compute",
* displayName: "Firebase App Hosting compute service account",
* createIgnoreAlreadyExists: true,
* });
* const fah = new gcp.projects.Service("fah", {
* project: "my-project-name",
* service: "firebaseapphosting.googleapis.com",
* });
* const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", {
* project: "my-project-name",
* location: "asia-east1",
* backendId: "traffic-rpd",
* appId: "1:0000000000:web:674cde32020e16fbce9dbd",
* servingLocality: "GLOBAL_ACCESS",
* serviceAccount: serviceAccount.email,
* }, {
* dependsOn: [fah],
* });
* const example = new gcp.firebase.AppHostingTraffic("example", {
* project: exampleAppHostingBackend.project,
* location: exampleAppHostingBackend.location,
* backend: exampleAppHostingBackend.backendId,
* rolloutPolicy: {
* disabled: true,
* codebaseBranch: "main",
* },
* });
* const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", {
* project: "my-project-name",
* role: "roles/firebaseapphosting.computeRunner",
* member: serviceAccount.member,
* });
* ```
*
* ## Import
*
* Traffic can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/backends/{{backend}}/traffic`
*
* * `{{project}}/{{location}}/{{backend}}`
*
* * `{{location}}/{{backend}}`
*
* When using the `pulumi import` command, Traffic can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:firebase/appHostingTraffic:AppHostingTraffic default projects/{{project}}/locations/{{location}}/backends/{{backend}}/traffic
* ```
*
* ```sh
* $ pulumi import gcp:firebase/appHostingTraffic:AppHostingTraffic default {{project}}/{{location}}/{{backend}}
* ```
*
* ```sh
* $ pulumi import gcp:firebase/appHostingTraffic:AppHostingTraffic default {{location}}/{{backend}}
* ```
*/
export declare class AppHostingTraffic extends pulumi.CustomResource {
/**
* Get an existing AppHostingTraffic 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?: AppHostingTrafficState, opts?: pulumi.CustomResourceOptions): AppHostingTraffic;
/**
* Returns true if the given object is an instance of AppHostingTraffic. 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 AppHostingTraffic;
/**
* Id of the backend that this Traffic config applies to
*/
readonly backend: pulumi.Output<string>;
/**
* Time at which the backend was created.
*/
readonly createTime: pulumi.Output<string>;
/**
* Current state of traffic allocation for the backend.
* When setting `target`, this field may differ for some time until the desired state is reached.
* Structure is documented below.
*/
readonly currents: pulumi.Output<outputs.firebase.AppHostingTrafficCurrent[]>;
/**
* Time at which the backend was deleted.
*/
readonly deleteTime: pulumi.Output<string>;
/**
* Server-computed checksum based on other values; may be sent
* on update or delete to ensure operation is done on expected resource.
*/
readonly etag: pulumi.Output<string>;
/**
* The location the Backend that this Traffic config applies to
*/
readonly location: pulumi.Output<string>;
/**
* Identifier. The resource name of the backend traffic config
* Format:
* `projects/{project}/locations/{locationId}/backends/{backendId}/traffic`.
*/
readonly name: pulumi.Output<string>;
/**
* 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 policy for how builds and rollouts are triggered and rolled out.
* Structure is documented below.
*/
readonly rolloutPolicy: pulumi.Output<outputs.firebase.AppHostingTrafficRolloutPolicy | undefined>;
/**
* Set to manually control the desired traffic for the backend. This will
* cause current to eventually match this value. The percentages must add
* up to 100.
* Structure is documented below.
*/
readonly target: pulumi.Output<outputs.firebase.AppHostingTrafficTarget | undefined>;
/**
* System-assigned, unique identifier.
*/
readonly uid: pulumi.Output<string>;
/**
* Time at which the backend was last updated.
*/
readonly updateTime: pulumi.Output<string>;
/**
* Create a AppHostingTraffic 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: AppHostingTrafficArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering AppHostingTraffic resources.
*/
export interface AppHostingTrafficState {
/**
* Id of the backend that this Traffic config applies to
*/
backend?: pulumi.Input<string>;
/**
* Time at which the backend was created.
*/
createTime?: pulumi.Input<string>;
/**
* Current state of traffic allocation for the backend.
* When setting `target`, this field may differ for some time until the desired state is reached.
* Structure is documented below.
*/
currents?: pulumi.Input<pulumi.Input<inputs.firebase.AppHostingTrafficCurrent>[]>;
/**
* Time at which the backend was deleted.
*/
deleteTime?: pulumi.Input<string>;
/**
* Server-computed checksum based on other values; may be sent
* on update or delete to ensure operation is done on expected resource.
*/
etag?: pulumi.Input<string>;
/**
* The location the Backend that this Traffic config applies to
*/
location?: pulumi.Input<string>;
/**
* Identifier. The resource name of the backend traffic config
* Format:
* `projects/{project}/locations/{locationId}/backends/{backendId}/traffic`.
*/
name?: pulumi.Input<string>;
/**
* 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 policy for how builds and rollouts are triggered and rolled out.
* Structure is documented below.
*/
rolloutPolicy?: pulumi.Input<inputs.firebase.AppHostingTrafficRolloutPolicy>;
/**
* Set to manually control the desired traffic for the backend. This will
* cause current to eventually match this value. The percentages must add
* up to 100.
* Structure is documented below.
*/
target?: pulumi.Input<inputs.firebase.AppHostingTrafficTarget>;
/**
* System-assigned, unique identifier.
*/
uid?: pulumi.Input<string>;
/**
* Time at which the backend was last updated.
*/
updateTime?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a AppHostingTraffic resource.
*/
export interface AppHostingTrafficArgs {
/**
* Id of the backend that this Traffic config applies to
*/
backend: pulumi.Input<string>;
/**
* The location the Backend that this Traffic config applies to
*/
location: pulumi.Input<string>;
/**
* 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 policy for how builds and rollouts are triggered and rolled out.
* Structure is documented below.
*/
rolloutPolicy?: pulumi.Input<inputs.firebase.AppHostingTrafficRolloutPolicy>;
/**
* Set to manually control the desired traffic for the backend. This will
* cause current to eventually match this value. The percentages must add
* up to 100.
* Structure is documented below.
*/
target?: pulumi.Input<inputs.firebase.AppHostingTrafficTarget>;
}