@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
245 lines • 9.29 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.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, { ...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?.createTime;
resourceInputs["deletionProtectionEnabled"] = state?.deletionProtectionEnabled;
resourceInputs["deletionProtectionReason"] = state?.deletionProtectionReason;
resourceInputs["description"] = state?.description;
resourceInputs["directoryServices"] = state?.directoryServices;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["effectiveReplications"] = state?.effectiveReplications;
resourceInputs["etag"] = state?.etag;
resourceInputs["fileShares"] = state?.fileShares;
resourceInputs["initialReplication"] = state?.initialReplication;
resourceInputs["kmsKeyName"] = state?.kmsKeyName;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["networks"] = state?.networks;
resourceInputs["performanceConfig"] = state?.performanceConfig;
resourceInputs["project"] = state?.project;
resourceInputs["protocol"] = state?.protocol;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["tags"] = state?.tags;
resourceInputs["tier"] = state?.tier;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.fileShares === undefined && !opts.urn) {
throw new Error("Missing required property 'fileShares'");
}
if (args?.networks === undefined && !opts.urn) {
throw new Error("Missing required property 'networks'");
}
if (args?.tier === undefined && !opts.urn) {
throw new Error("Missing required property 'tier'");
}
resourceInputs["deletionProtectionEnabled"] = args?.deletionProtectionEnabled;
resourceInputs["deletionProtectionReason"] = args?.deletionProtectionReason;
resourceInputs["description"] = args?.description;
resourceInputs["directoryServices"] = args?.directoryServices;
resourceInputs["fileShares"] = args?.fileShares;
resourceInputs["initialReplication"] = args?.initialReplication;
resourceInputs["kmsKeyName"] = args?.kmsKeyName;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["networks"] = args?.networks;
resourceInputs["performanceConfig"] = args?.performanceConfig;
resourceInputs["project"] = args?.project;
resourceInputs["protocol"] = args?.protocol;
resourceInputs["tags"] = args?.tags;
resourceInputs["tier"] = args?.tier;
resourceInputs["zone"] = args?.zone;
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
;