UNPKG

@pulumi/gcp

Version:

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

309 lines • 12.9 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppHostingBuild = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A single build for a backend, at a specific point codebase reference tag * and point in time. Encapsulates several resources, including an Artifact Registry * container image, a Cloud Build invocation that built the image, and the * Cloud Run revision that uses that image. * * ## Example Usage * * ### Firebase App Hosting Build Minimal * * ```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: "us-central1", * backendId: "mini", * appId: "1:0000000000:web:674cde32020e16fbce9dbd", * servingLocality: "GLOBAL_ACCESS", * serviceAccount: serviceAccount.email, * }, { * dependsOn: [fah], * }); * const example = new gcp.firebase.AppHostingBuild("example", { * project: exampleAppHostingBackend.project, * location: exampleAppHostingBackend.location, * backend: exampleAppHostingBackend.backendId, * buildId: "mini-build", * source: { * container: { * image: "us-docker.pkg.dev/cloudrun/container/hello", * }, * }, * }); * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", { * project: "my-project-name", * role: "roles/firebaseapphosting.computeRunner", * member: serviceAccount.member, * }); * ``` * ### Firebase App Hosting Build Full * * ```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: "us-central1", * backendId: "full", * appId: "1:0000000000:web:674cde32020e16fbce9dbd", * servingLocality: "GLOBAL_ACCESS", * serviceAccount: serviceAccount.email, * }, { * dependsOn: [fah], * }); * const example = new gcp.firebase.AppHostingBuild("example", { * project: exampleAppHostingBackend.project, * location: exampleAppHostingBackend.location, * backend: exampleAppHostingBackend.backendId, * buildId: "full-build", * displayName: "My Build", * annotations: { * key: "value", * }, * labels: { * key: "value", * }, * source: { * container: { * image: "us-docker.pkg.dev/cloudrun/container/hello", * }, * }, * }); * const appHostingSaRunner = new gcp.projects.IAMMember("app_hosting_sa_runner", { * project: "my-project-name", * role: "roles/firebaseapphosting.computeRunner", * member: serviceAccount.member, * }); * ``` * ### Firebase App Hosting Build Github * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const my_repository = new gcp.developerconnect.GitRepositoryLink("my-repository", { * project: "my-project-name", * location: "us-central1", * service: "developerconnect.googleapis.com", * }); * const exampleAppHostingBackend = new gcp.firebase.AppHostingBackend("example", { * project: "my-project-name", * location: "us-central1", * backendId: "mini", * appId: "1:0000000000:web:674cde32020e16fbce9dbd", * displayName: "My Backend", * servingLocality: "GLOBAL_ACCESS", * serviceAccount: "firebase-app-hosting-compute@my-project-name.iam.gserviceaccount.com", * environment: "prod", * annotations: { * key: "value", * }, * labels: { * key: "value", * }, * codebase: { * repository: my_repository.name, * rootDirectory: "/", * }, * }); * const example = new gcp.firebase.AppHostingBuild("example", { * project: exampleAppHostingBackend.project, * location: exampleAppHostingBackend.location, * backend: exampleAppHostingBackend.backendId, * buildId: "gh-build", * source: { * codebase: { * branch: "main", * }, * }, * }); * const devconnect_secret = new gcp.projects.IAMMember("devconnect-secret", { * project: "my-project-name", * role: "roles/secretmanager.admin", * member: devconnect_p4sa.member, * }); * //## * //## Include these blocks only once per Github account ### * const my_connection = new gcp.developerconnect.Connection("my-connection", { * project: "my-project-name", * location: "us-central1", * connectionId: "tf-test-connection-new", * githubConfig: { * githubApp: "FIREBASE", * }, * }, { * dependsOn: [devconnect_secret], * }); * export const nextSteps = my_connection.installationStates; * ``` * * ## Import * * Build can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/backends/{{backend}}/builds/{{build_id}}` * * `{{project}}/{{location}}/{{backend}}/{{build_id}}` * * `{{location}}/{{backend}}/{{build_id}}` * * When using the `pulumi import` command, Build can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:firebase/appHostingBuild:AppHostingBuild default projects/{{project}}/locations/{{location}}/backends/{{backend}}/builds/{{build_id}} * $ pulumi import gcp:firebase/appHostingBuild:AppHostingBuild default {{project}}/{{location}}/{{backend}}/{{build_id}} * $ pulumi import gcp:firebase/appHostingBuild:AppHostingBuild default {{location}}/{{backend}}/{{build_id}} * ``` */ class AppHostingBuild extends pulumi.CustomResource { /** * Get an existing AppHostingBuild 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, id, state, opts) { return new AppHostingBuild(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:firebase/appHostingBuild:AppHostingBuild'; /** * Returns true if the given object is an instance of AppHostingBuild. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === AppHostingBuild.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["annotations"] = state?.annotations; resourceInputs["backend"] = state?.backend; resourceInputs["buildId"] = state?.buildId; resourceInputs["buildLogsUri"] = state?.buildLogsUri; resourceInputs["createTime"] = state?.createTime; resourceInputs["displayName"] = state?.displayName; resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["environment"] = state?.environment; resourceInputs["errorSource"] = state?.errorSource; resourceInputs["errors"] = state?.errors; resourceInputs["etag"] = state?.etag; resourceInputs["image"] = state?.image; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["source"] = state?.source; resourceInputs["state"] = state?.state; resourceInputs["uid"] = state?.uid; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.backend === undefined && !opts.urn) { throw new Error("Missing required property 'backend'"); } if (args?.buildId === undefined && !opts.urn) { throw new Error("Missing required property 'buildId'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.source === undefined && !opts.urn) { throw new Error("Missing required property 'source'"); } resourceInputs["annotations"] = args?.annotations; resourceInputs["backend"] = args?.backend; resourceInputs["buildId"] = args?.buildId; resourceInputs["displayName"] = args?.displayName; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["project"] = args?.project; resourceInputs["source"] = args?.source; resourceInputs["buildLogsUri"] = undefined /*out*/; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveAnnotations"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["environment"] = undefined /*out*/; resourceInputs["errorSource"] = undefined /*out*/; resourceInputs["errors"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["image"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["uid"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(AppHostingBuild.__pulumiType, name, resourceInputs, opts); } } exports.AppHostingBuild = AppHostingBuild; //# sourceMappingURL=appHostingBuild.js.map