UNPKG

@pulumi/gcp

Version:

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

188 lines (187 loc) 6.64 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Traffic routing configuration for versions within a single service. Traffic splits define how traffic directed to the service is assigned to versions. * * To get more information about ServiceSplitTraffic, see: * * * [API documentation](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services) * * ## Example Usage * * ### App Engine Service Split Traffic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const bucket = new gcp.storage.Bucket("bucket", { * name: "appengine-static-content", * location: "US", * }); * const object = new gcp.storage.BucketObject("object", { * name: "hello-world.zip", * bucket: bucket.name, * source: new pulumi.asset.FileAsset("./test-fixtures/hello-world.zip"), * }); * const liveappV1 = new gcp.appengine.StandardAppVersion("liveapp_v1", { * versionId: "v1", * service: "liveapp", * deleteServiceOnDestroy: true, * runtime: "nodejs20", * entrypoint: { * shell: "node ./app.js", * }, * deployment: { * zip: { * sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`, * }, * }, * envVariables: { * port: "8080", * }, * }); * const liveappV2 = new gcp.appengine.StandardAppVersion("liveapp_v2", { * versionId: "v2", * service: "liveapp", * noopOnDestroy: true, * runtime: "nodejs20", * entrypoint: { * shell: "node ./app.js", * }, * deployment: { * zip: { * sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`, * }, * }, * envVariables: { * port: "8080", * }, * }); * const liveapp = new gcp.appengine.EngineSplitTraffic("liveapp", { * service: liveappV2.service, * migrateTraffic: false, * split: { * shardBy: "IP", * allocations: pulumi.all([liveappV1.versionId, liveappV2.versionId]).apply(([liveappV1VersionId, liveappV2VersionId]) => { * [liveappV1VersionId]: 0.75, * [liveappV2VersionId]: 0.25, * }), * }, * }); * ``` * * ## Import * * ServiceSplitTraffic can be imported using any of these accepted formats: * * * `apps/{{project}}/services/{{service}}` * * * `{{project}}/{{service}}` * * * `{{service}}` * * When using the `pulumi import` command, ServiceSplitTraffic can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:appengine/engineSplitTraffic:EngineSplitTraffic default apps/{{project}}/services/{{service}} * ``` * * ```sh * $ pulumi import gcp:appengine/engineSplitTraffic:EngineSplitTraffic default {{project}}/{{service}} * ``` * * ```sh * $ pulumi import gcp:appengine/engineSplitTraffic:EngineSplitTraffic default {{service}} * ``` */ export declare class EngineSplitTraffic extends pulumi.CustomResource { /** * Get an existing EngineSplitTraffic 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?: EngineSplitTrafficState, opts?: pulumi.CustomResourceOptions): EngineSplitTraffic; /** * Returns true if the given object is an instance of EngineSplitTraffic. 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 EngineSplitTraffic; /** * If set to true traffic will be migrated to this version. */ readonly migrateTraffic: pulumi.Output<boolean | 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 name of the service these settings apply to. */ readonly service: pulumi.Output<string>; /** * Mapping that defines fractional HTTP traffic diversion to different versions within the service. * Structure is documented below. */ readonly split: pulumi.Output<outputs.appengine.EngineSplitTrafficSplit>; /** * Create a EngineSplitTraffic 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: EngineSplitTrafficArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering EngineSplitTraffic resources. */ export interface EngineSplitTrafficState { /** * If set to true traffic will be migrated to this version. */ migrateTraffic?: pulumi.Input<boolean>; /** * 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 name of the service these settings apply to. */ service?: pulumi.Input<string>; /** * Mapping that defines fractional HTTP traffic diversion to different versions within the service. * Structure is documented below. */ split?: pulumi.Input<inputs.appengine.EngineSplitTrafficSplit>; } /** * The set of arguments for constructing a EngineSplitTraffic resource. */ export interface EngineSplitTrafficArgs { /** * If set to true traffic will be migrated to this version. */ migrateTraffic?: pulumi.Input<boolean>; /** * 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 name of the service these settings apply to. */ service: pulumi.Input<string>; /** * Mapping that defines fractional HTTP traffic diversion to different versions within the service. * Structure is documented below. */ split: pulumi.Input<inputs.appengine.EngineSplitTrafficSplit>; }