UNPKG

@pulumi/gcp

Version:

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

248 lines • 11.3 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Instance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Alloydb Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"}); * const defaultCluster = new gcp.alloydb.Cluster("default", { * clusterId: "alloydb-cluster", * location: "us-central1", * networkConfig: { * network: defaultNetwork.id, * }, * initialUser: { * password: "alloydb-cluster", * }, * }); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "alloydb-cluster", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: defaultNetwork.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: defaultNetwork.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const _default = new gcp.alloydb.Instance("default", { * cluster: defaultCluster.name, * instanceId: "alloydb-instance", * instanceType: "PRIMARY", * machineConfig: { * cpuCount: 2, * }, * }, { * dependsOn: [vpcConnection], * }); * const project = gcp.organizations.getProject({}); * ``` * ### Alloydb Secondary Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", {name: "alloydb-secondary-network"}); * const primary = new gcp.alloydb.Cluster("primary", { * clusterId: "alloydb-primary-cluster", * location: "us-central1", * networkConfig: { * network: _default.id, * }, * }); * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", { * name: "alloydb-secondary-instance", * addressType: "INTERNAL", * purpose: "VPC_PEERING", * prefixLength: 16, * network: _default.id, * }); * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", { * network: _default.id, * service: "servicenetworking.googleapis.com", * reservedPeeringRanges: [privateIpAlloc.name], * }); * const primaryInstance = new gcp.alloydb.Instance("primary", { * cluster: primary.name, * instanceId: "alloydb-primary-instance", * instanceType: "PRIMARY", * machineConfig: { * cpuCount: 2, * }, * }, { * dependsOn: [vpcConnection], * }); * const secondary = new gcp.alloydb.Cluster("secondary", { * clusterId: "alloydb-secondary-cluster", * location: "us-east1", * networkConfig: { * network: defaultGoogleComputeNetwork.id, * }, * clusterType: "SECONDARY", * continuousBackupConfig: { * enabled: false, * }, * secondaryConfig: { * primaryClusterName: primary.name, * }, * deletionPolicy: "FORCE", * }, { * dependsOn: [primaryInstance], * }); * const secondaryInstance = new gcp.alloydb.Instance("secondary", { * cluster: secondary.name, * instanceId: "alloydb-secondary-instance", * instanceType: secondary.clusterType, * machineConfig: { * cpuCount: 2, * }, * }, { * dependsOn: [vpcConnection], * }); * const project = gcp.organizations.getProject({}); * ``` * * ## Import * * Instance can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/instances/{{instance_id}}` * * * `{{project}}/{{location}}/{{cluster}}/{{instance_id}}` * * * `{{location}}/{{cluster}}/{{instance_id}}` * * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:alloydb/instance:Instance default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/instances/{{instance_id}} * ``` * * ```sh * $ pulumi import gcp:alloydb/instance:Instance default {{project}}/{{location}}/{{cluster}}/{{instance_id}} * ``` * * ```sh * $ pulumi import gcp:alloydb/instance:Instance default {{location}}/{{cluster}}/{{instance_id}} * ``` */ class Instance extends pulumi.CustomResource { /** * Get an existing Instance 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 Instance(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["annotations"] = state ? state.annotations : undefined; resourceInputs["availabilityType"] = state ? state.availabilityType : undefined; resourceInputs["clientConnectionConfig"] = state ? state.clientConnectionConfig : undefined; resourceInputs["cluster"] = state ? state.cluster : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["databaseFlags"] = state ? state.databaseFlags : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["effectiveAnnotations"] = state ? state.effectiveAnnotations : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["gceZone"] = state ? state.gceZone : undefined; resourceInputs["instanceId"] = state ? state.instanceId : undefined; resourceInputs["instanceType"] = state ? state.instanceType : undefined; resourceInputs["ipAddress"] = state ? state.ipAddress : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["machineConfig"] = state ? state.machineConfig : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkConfig"] = state ? state.networkConfig : undefined; resourceInputs["observabilityConfig"] = state ? state.observabilityConfig : undefined; resourceInputs["outboundPublicIpAddresses"] = state ? state.outboundPublicIpAddresses : undefined; resourceInputs["pscInstanceConfig"] = state ? state.pscInstanceConfig : undefined; resourceInputs["publicIpAddress"] = state ? state.publicIpAddress : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["queryInsightsConfig"] = state ? state.queryInsightsConfig : undefined; resourceInputs["readPoolConfig"] = state ? state.readPoolConfig : undefined; resourceInputs["reconciling"] = state ? state.reconciling : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["uid"] = state ? state.uid : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; } else { const args = argsOrState; if ((!args || args.cluster === undefined) && !opts.urn) { throw new Error("Missing required property 'cluster'"); } if ((!args || args.instanceId === undefined) && !opts.urn) { throw new Error("Missing required property 'instanceId'"); } if ((!args || args.instanceType === undefined) && !opts.urn) { throw new Error("Missing required property 'instanceType'"); } resourceInputs["annotations"] = args ? args.annotations : undefined; resourceInputs["availabilityType"] = args ? args.availabilityType : undefined; resourceInputs["clientConnectionConfig"] = args ? args.clientConnectionConfig : undefined; resourceInputs["cluster"] = args ? args.cluster : undefined; resourceInputs["databaseFlags"] = args ? args.databaseFlags : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["gceZone"] = args ? args.gceZone : undefined; resourceInputs["instanceId"] = args ? args.instanceId : undefined; resourceInputs["instanceType"] = args ? args.instanceType : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["machineConfig"] = args ? args.machineConfig : undefined; resourceInputs["networkConfig"] = args ? args.networkConfig : undefined; resourceInputs["observabilityConfig"] = args ? args.observabilityConfig : undefined; resourceInputs["pscInstanceConfig"] = args ? args.pscInstanceConfig : undefined; resourceInputs["queryInsightsConfig"] = args ? args.queryInsightsConfig : undefined; resourceInputs["readPoolConfig"] = args ? args.readPoolConfig : undefined; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveAnnotations"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["ipAddress"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["outboundPublicIpAddresses"] = undefined /*out*/; resourceInputs["publicIpAddress"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["reconciling"] = 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(Instance.__pulumiType, name, resourceInputs, opts); } } exports.Instance = Instance; /** @internal */ Instance.__pulumiType = 'gcp:alloydb/instance:Instance'; //# sourceMappingURL=instance.js.map