@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
242 lines • 9.62 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Connection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A connection to a SCM like GitHub, GitHub Enterprise, Bitbucket Data Center/Cloud or GitLab.
*
* To get more information about Connection, see:
*
* * [API documentation](https://cloud.google.com/build/docs/api/reference/rest)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/build/docs)
*
* ## Example Usage
*
* ### Cloudbuildv2 Connection
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const my_connection = new gcp.cloudbuildv2.Connection("my-connection", {
* location: "us-central1",
* name: "tf-test-connection",
* githubConfig: {
* appInstallationId: 0,
* authorizerCredential: {
* oauthTokenSecretVersion: "projects/gcb-terraform-creds/secrets/github-pat/versions/1",
* },
* },
* });
* ```
* ### Cloudbuildv2 Connection Ghe
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const private_key_secret = new gcp.secretmanager.Secret("private-key-secret", {
* secretId: "ghe-pk-secret",
* replication: {
* auto: {},
* },
* });
* const private_key_secret_version = new gcp.secretmanager.SecretVersion("private-key-secret-version", {
* secret: private_key_secret.id,
* secretData: std.file({
* input: "private-key.pem",
* }).then(invoke => invoke.result),
* });
* const webhook_secret_secret = new gcp.secretmanager.Secret("webhook-secret-secret", {
* secretId: "github-token-secret",
* replication: {
* auto: {},
* },
* });
* const webhook_secret_secret_version = new gcp.secretmanager.SecretVersion("webhook-secret-secret-version", {
* secret: webhook_secret_secret.id,
* secretData: "<webhook-secret-data>",
* });
* const p4sa_secretAccessor = gcp.organizations.getIAMPolicy({
* bindings: [{
* role: "roles/secretmanager.secretAccessor",
* members: ["serviceAccount:service-123456789@gcp-sa-cloudbuild.iam.gserviceaccount.com"],
* }],
* });
* const policy_pk = new gcp.secretmanager.SecretIamPolicy("policy-pk", {
* secretId: private_key_secret.secretId,
* policyData: p4sa_secretAccessor.then(p4sa_secretAccessor => p4sa_secretAccessor.policyData),
* });
* const policy_whs = new gcp.secretmanager.SecretIamPolicy("policy-whs", {
* secretId: webhook_secret_secret.secretId,
* policyData: p4sa_secretAccessor.then(p4sa_secretAccessor => p4sa_secretAccessor.policyData),
* });
* const my_connection = new gcp.cloudbuildv2.Connection("my-connection", {
* location: "us-central1",
* name: "my-terraform-ghe-connection",
* githubEnterpriseConfig: {
* hostUri: "https://ghe.com",
* privateKeySecretVersion: private_key_secret_version.id,
* webhookSecretSecretVersion: webhook_secret_secret_version.id,
* appId: 200,
* appSlug: "gcb-app",
* appInstallationId: 300,
* },
* }, {
* dependsOn: [
* policy_pk,
* policy_whs,
* ],
* });
* ```
* ### Cloudbuildv2 Connection Github
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const github_token_secret = new gcp.secretmanager.Secret("github-token-secret", {
* secretId: "github-token-secret",
* replication: {
* auto: {},
* },
* });
* const github_token_secret_version = new gcp.secretmanager.SecretVersion("github-token-secret-version", {
* secret: github_token_secret.id,
* secretData: std.file({
* input: "my-github-token.txt",
* }).then(invoke => invoke.result),
* });
* const p4sa_secretAccessor = gcp.organizations.getIAMPolicy({
* bindings: [{
* role: "roles/secretmanager.secretAccessor",
* members: ["serviceAccount:service-123456789@gcp-sa-cloudbuild.iam.gserviceaccount.com"],
* }],
* });
* const policy = new gcp.secretmanager.SecretIamPolicy("policy", {
* secretId: github_token_secret.secretId,
* policyData: p4sa_secretAccessor.then(p4sa_secretAccessor => p4sa_secretAccessor.policyData),
* });
* const my_connection = new gcp.cloudbuildv2.Connection("my-connection", {
* location: "us-central1",
* name: "my-connection",
* githubConfig: {
* appInstallationId: 123123,
* authorizerCredential: {
* oauthTokenSecretVersion: github_token_secret_version.id,
* },
* },
* });
* ```
*
* ## Import
*
* Connection can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/connections/{{name}}`
*
* * `{{project}}/{{location}}/{{name}}`
*
* * `{{location}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Connection can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:cloudbuildv2/connection:Connection default projects/{{project}}/locations/{{location}}/connections/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:cloudbuildv2/connection:Connection default {{project}}/{{location}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:cloudbuildv2/connection:Connection default {{location}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:cloudbuildv2/connection:Connection default {{name}}
* ```
*/
class Connection extends pulumi.CustomResource {
/**
* Get an existing Connection 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 Connection(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Connection. 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'] === Connection.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["annotations"] = state?.annotations;
resourceInputs["bitbucketCloudConfig"] = state?.bitbucketCloudConfig;
resourceInputs["bitbucketDataCenterConfig"] = state?.bitbucketDataCenterConfig;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["disabled"] = state?.disabled;
resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
resourceInputs["etag"] = state?.etag;
resourceInputs["githubConfig"] = state?.githubConfig;
resourceInputs["githubEnterpriseConfig"] = state?.githubEnterpriseConfig;
resourceInputs["gitlabConfig"] = state?.gitlabConfig;
resourceInputs["installationStates"] = state?.installationStates;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["reconciling"] = state?.reconciling;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["annotations"] = args?.annotations;
resourceInputs["bitbucketCloudConfig"] = args?.bitbucketCloudConfig;
resourceInputs["bitbucketDataCenterConfig"] = args?.bitbucketDataCenterConfig;
resourceInputs["disabled"] = args?.disabled;
resourceInputs["githubConfig"] = args?.githubConfig;
resourceInputs["githubEnterpriseConfig"] = args?.githubEnterpriseConfig;
resourceInputs["gitlabConfig"] = args?.gitlabConfig;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveAnnotations"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["installationStates"] = undefined /*out*/;
resourceInputs["reconciling"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Connection.__pulumiType, name, resourceInputs, opts);
}
}
exports.Connection = Connection;
/** @internal */
Connection.__pulumiType = 'gcp:cloudbuildv2/connection:Connection';
//# sourceMappingURL=connection.js.map
;