UNPKG

@pulumi/gcp

Version:

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

243 lines • 9.9 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"); /** * A Google Cloud Filestore instance. * * To get more information about Instance, see: * * * [API documentation](https://cloud.google.com/filestore/docs/reference/rest/v1beta1/projects.locations.instances/create) * * How-to Guides * * [Copying Data In/Out](https://cloud.google.com/filestore/docs/copying-data) * * [Official Documentation](https://cloud.google.com/filestore/docs/creating-instances) * * [Use with Kubernetes](https://cloud.google.com/filestore/docs/accessing-fileshares) * * ## Example Usage * * ### Filestore Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.filestore.Instance("instance", { * name: "test-instance", * location: "us-central1-b", * tier: "BASIC_HDD", * fileShares: { * capacityGb: 1024, * name: "share1", * }, * networks: [{ * network: "default", * modes: ["MODE_IPV4"], * }], * }); * ``` * ### Filestore Instance Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.filestore.Instance("instance", { * name: "test-instance", * location: "us-central1-b", * tier: "BASIC_SSD", * fileShares: { * capacityGb: 2560, * name: "share1", * nfsExportOptions: [ * { * ipRanges: ["10.0.0.0/24"], * accessMode: "READ_WRITE", * squashMode: "NO_ROOT_SQUASH", * }, * { * ipRanges: ["10.10.0.0/24"], * accessMode: "READ_ONLY", * squashMode: "ROOT_SQUASH", * anonUid: 123, * anonGid: 456, * }, * ], * }, * networks: [{ * network: "default", * modes: ["MODE_IPV4"], * connectMode: "DIRECT_PEERING", * }], * }); * ``` * ### Filestore Instance Protocol * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.filestore.Instance("instance", { * name: "test-instance", * location: "us-central1", * tier: "ENTERPRISE", * protocol: "NFS_V4_1", * fileShares: { * capacityGb: 1024, * name: "share1", * }, * networks: [{ * network: "default", * modes: ["MODE_IPV4"], * }], * }); * ``` * ### Filestore Instance Enterprise * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const filestoreKeyring = new gcp.kms.KeyRing("filestore_keyring", { * name: "filestore-keyring", * location: "us-central1", * }); * const filestoreKey = new gcp.kms.CryptoKey("filestore_key", { * name: "filestore-key", * keyRing: filestoreKeyring.id, * }); * const instance = new gcp.filestore.Instance("instance", { * name: "test-instance", * location: "us-central1", * tier: "ENTERPRISE", * fileShares: { * capacityGb: 1024, * name: "share1", * }, * networks: [{ * network: "default", * modes: ["MODE_IPV4"], * }], * kmsKeyName: filestoreKey.id, * }); * ``` * * ## Import * * Instance can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/instances/{{name}}` * * * `{{project}}/{{location}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:filestore/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{name}} * ``` * * ```sh * $ pulumi import gcp:filestore/instance:Instance default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:filestore/instance:Instance default {{location}}/{{name}} * ``` */ 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["createTime"] = state ? state.createTime : undefined; resourceInputs["deletionProtectionEnabled"] = state ? state.deletionProtectionEnabled : undefined; resourceInputs["deletionProtectionReason"] = state ? state.deletionProtectionReason : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["effectiveReplications"] = state ? state.effectiveReplications : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["fileShares"] = state ? state.fileShares : undefined; resourceInputs["initialReplication"] = state ? state.initialReplication : undefined; resourceInputs["kmsKeyName"] = state ? state.kmsKeyName : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networks"] = state ? state.networks : undefined; resourceInputs["performanceConfig"] = state ? state.performanceConfig : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["protocol"] = state ? state.protocol : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tier"] = state ? state.tier : undefined; resourceInputs["zone"] = state ? state.zone : undefined; } else { const args = argsOrState; if ((!args || args.fileShares === undefined) && !opts.urn) { throw new Error("Missing required property 'fileShares'"); } if ((!args || args.networks === undefined) && !opts.urn) { throw new Error("Missing required property 'networks'"); } if ((!args || args.tier === undefined) && !opts.urn) { throw new Error("Missing required property 'tier'"); } resourceInputs["deletionProtectionEnabled"] = args ? args.deletionProtectionEnabled : undefined; resourceInputs["deletionProtectionReason"] = args ? args.deletionProtectionReason : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["fileShares"] = args ? args.fileShares : undefined; resourceInputs["initialReplication"] = args ? args.initialReplication : undefined; resourceInputs["kmsKeyName"] = args ? args.kmsKeyName : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networks"] = args ? args.networks : undefined; resourceInputs["performanceConfig"] = args ? args.performanceConfig : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["protocol"] = args ? args.protocol : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["tier"] = args ? args.tier : undefined; resourceInputs["zone"] = args ? args.zone : undefined; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["effectiveReplications"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["pulumiLabels"] = 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:filestore/instance:Instance'; //# sourceMappingURL=instance.js.map