All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.filestore.kotlin.Instance.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.filestore.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.filestore.kotlin.outputs.InstanceFileShares
import com.pulumi.gcp.filestore.kotlin.outputs.InstanceNetwork
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.filestore.kotlin.outputs.InstanceFileShares.Companion.toKotlin as instanceFileSharesToKotlin
import com.pulumi.gcp.filestore.kotlin.outputs.InstanceNetwork.Companion.toKotlin as instanceNetworkToKotlin

/**
 * Builder for [Instance].
 */
@PulumiTagMarker
public class InstanceResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: InstanceArgs = InstanceArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend InstanceArgsBuilder.() -> Unit) {
        val builder = InstanceArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Instance {
        val builtJavaResource = com.pulumi.gcp.filestore.Instance(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Instance(builtJavaResource)
    }
}

/**
 * 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
 *     * [Official Documentation](https://cloud.google.com/filestore/docs/creating-instances)
 *     * [Use with Kubernetes](https://cloud.google.com/filestore/docs/accessing-fileshares)
 *     * [Copying Data In/Out](https://cloud.google.com/filestore/docs/copying-data)
 * ## 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"],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.filestore.Instance("instance",
 *     name="test-instance",
 *     location="us-central1-b",
 *     tier="BASIC_HDD",
 *     file_shares=gcp.filestore.InstanceFileSharesArgs(
 *         capacity_gb=1024,
 *         name="share1",
 *     ),
 *     networks=[gcp.filestore.InstanceNetworkArgs(
 *         network="default",
 *         modes=["MODE_IPV4"],
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Filestore.Instance("instance", new()
 *     {
 *         Name = "test-instance",
 *         Location = "us-central1-b",
 *         Tier = "BASIC_HDD",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 1024,
 *             Name = "share1",
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := filestore.NewInstance(ctx, "instance", &filestore.InstanceArgs{
 * 			Name:     pulumi.String("test-instance"),
 * 			Location: pulumi.String("us-central1-b"),
 * 			Tier:     pulumi.String("BASIC_HDD"),
 * 			FileShares: &filestore.InstanceFileSharesArgs{
 * 				CapacityGb: pulumi.Int(1024),
 * 				Name:       pulumi.String("share1"),
 * 			},
 * 			Networks: filestore.InstanceNetworkArray{
 * 				&filestore.InstanceNetworkArgs{
 * 					Network: pulumi.String("default"),
 * 					Modes: pulumi.StringArray{
 * 						pulumi.String("MODE_IPV4"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.filestore.Instance;
 * import com.pulumi.gcp.filestore.InstanceArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var instance = new Instance("instance", InstanceArgs.builder()
 *             .name("test-instance")
 *             .location("us-central1-b")
 *             .tier("BASIC_HDD")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(1024)
 *                 .name("share1")
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       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",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.filestore.Instance("instance",
 *     name="test-instance",
 *     location="us-central1-b",
 *     tier="BASIC_SSD",
 *     file_shares=gcp.filestore.InstanceFileSharesArgs(
 *         capacity_gb=2560,
 *         name="share1",
 *         nfs_export_options=[
 *             gcp.filestore.InstanceFileSharesNfsExportOptionArgs(
 *                 ip_ranges=["10.0.0.0/24"],
 *                 access_mode="READ_WRITE",
 *                 squash_mode="NO_ROOT_SQUASH",
 *             ),
 *             gcp.filestore.InstanceFileSharesNfsExportOptionArgs(
 *                 ip_ranges=["10.10.0.0/24"],
 *                 access_mode="READ_ONLY",
 *                 squash_mode="ROOT_SQUASH",
 *                 anon_uid=123,
 *                 anon_gid=456,
 *             ),
 *         ],
 *     ),
 *     networks=[gcp.filestore.InstanceNetworkArgs(
 *         network="default",
 *         modes=["MODE_IPV4"],
 *         connect_mode="DIRECT_PEERING",
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Filestore.Instance("instance", new()
 *     {
 *         Name = "test-instance",
 *         Location = "us-central1-b",
 *         Tier = "BASIC_SSD",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 2560,
 *             Name = "share1",
 *             NfsExportOptions = new[]
 *             {
 *                 new Gcp.Filestore.Inputs.InstanceFileSharesNfsExportOptionArgs
 *                 {
 *                     IpRanges = new[]
 *                     {
 *                         "10.0.0.0/24",
 *                     },
 *                     AccessMode = "READ_WRITE",
 *                     SquashMode = "NO_ROOT_SQUASH",
 *                 },
 *                 new Gcp.Filestore.Inputs.InstanceFileSharesNfsExportOptionArgs
 *                 {
 *                     IpRanges = new[]
 *                     {
 *                         "10.10.0.0/24",
 *                     },
 *                     AccessMode = "READ_ONLY",
 *                     SquashMode = "ROOT_SQUASH",
 *                     AnonUid = 123,
 *                     AnonGid = 456,
 *                 },
 *             },
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *                 ConnectMode = "DIRECT_PEERING",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := filestore.NewInstance(ctx, "instance", &filestore.InstanceArgs{
 * 			Name:     pulumi.String("test-instance"),
 * 			Location: pulumi.String("us-central1-b"),
 * 			Tier:     pulumi.String("BASIC_SSD"),
 * 			FileShares: &filestore.InstanceFileSharesArgs{
 * 				CapacityGb: pulumi.Int(2560),
 * 				Name:       pulumi.String("share1"),
 * 				NfsExportOptions: filestore.InstanceFileSharesNfsExportOptionArray{
 * 					&filestore.InstanceFileSharesNfsExportOptionArgs{
 * 						IpRanges: pulumi.StringArray{
 * 							pulumi.String("10.0.0.0/24"),
 * 						},
 * 						AccessMode: pulumi.String("READ_WRITE"),
 * 						SquashMode: pulumi.String("NO_ROOT_SQUASH"),
 * 					},
 * 					&filestore.InstanceFileSharesNfsExportOptionArgs{
 * 						IpRanges: pulumi.StringArray{
 * 							pulumi.String("10.10.0.0/24"),
 * 						},
 * 						AccessMode: pulumi.String("READ_ONLY"),
 * 						SquashMode: pulumi.String("ROOT_SQUASH"),
 * 						AnonUid:    pulumi.Int(123),
 * 						AnonGid:    pulumi.Int(456),
 * 					},
 * 				},
 * 			},
 * 			Networks: filestore.InstanceNetworkArray{
 * 				&filestore.InstanceNetworkArgs{
 * 					Network: pulumi.String("default"),
 * 					Modes: pulumi.StringArray{
 * 						pulumi.String("MODE_IPV4"),
 * 					},
 * 					ConnectMode: pulumi.String("DIRECT_PEERING"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.filestore.Instance;
 * import com.pulumi.gcp.filestore.InstanceArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var instance = new Instance("instance", InstanceArgs.builder()
 *             .name("test-instance")
 *             .location("us-central1-b")
 *             .tier("BASIC_SSD")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(2560)
 *                 .name("share1")
 *                 .nfsExportOptions(
 *                     InstanceFileSharesNfsExportOptionArgs.builder()
 *                         .ipRanges("10.0.0.0/24")
 *                         .accessMode("READ_WRITE")
 *                         .squashMode("NO_ROOT_SQUASH")
 *                         .build(),
 *                     InstanceFileSharesNfsExportOptionArgs.builder()
 *                         .ipRanges("10.10.0.0/24")
 *                         .accessMode("READ_ONLY")
 *                         .squashMode("ROOT_SQUASH")
 *                         .anonUid(123)
 *                         .anonGid(456)
 *                         .build())
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .connectMode("DIRECT_PEERING")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       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"],
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.filestore.Instance("instance",
 *     name="test-instance",
 *     location="us-central1",
 *     tier="ENTERPRISE",
 *     protocol="NFS_V4_1",
 *     file_shares=gcp.filestore.InstanceFileSharesArgs(
 *         capacity_gb=1024,
 *         name="share1",
 *     ),
 *     networks=[gcp.filestore.InstanceNetworkArgs(
 *         network="default",
 *         modes=["MODE_IPV4"],
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Filestore.Instance("instance", new()
 *     {
 *         Name = "test-instance",
 *         Location = "us-central1",
 *         Tier = "ENTERPRISE",
 *         Protocol = "NFS_V4_1",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 1024,
 *             Name = "share1",
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := filestore.NewInstance(ctx, "instance", &filestore.InstanceArgs{
 * 			Name:     pulumi.String("test-instance"),
 * 			Location: pulumi.String("us-central1"),
 * 			Tier:     pulumi.String("ENTERPRISE"),
 * 			Protocol: pulumi.String("NFS_V4_1"),
 * 			FileShares: &filestore.InstanceFileSharesArgs{
 * 				CapacityGb: pulumi.Int(1024),
 * 				Name:       pulumi.String("share1"),
 * 			},
 * 			Networks: filestore.InstanceNetworkArray{
 * 				&filestore.InstanceNetworkArgs{
 * 					Network: pulumi.String("default"),
 * 					Modes: pulumi.StringArray{
 * 						pulumi.String("MODE_IPV4"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.filestore.Instance;
 * import com.pulumi.gcp.filestore.InstanceArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var instance = new Instance("instance", InstanceArgs.builder()
 *             .name("test-instance")
 *             .location("us-central1")
 *             .tier("ENTERPRISE")
 *             .protocol("NFS_V4_1")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(1024)
 *                 .name("share1")
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       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,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * filestore_keyring = gcp.kms.KeyRing("filestore_keyring",
 *     name="filestore-keyring",
 *     location="us-central1")
 * filestore_key = gcp.kms.CryptoKey("filestore_key",
 *     name="filestore-key",
 *     key_ring=filestore_keyring.id)
 * instance = gcp.filestore.Instance("instance",
 *     name="test-instance",
 *     location="us-central1",
 *     tier="ENTERPRISE",
 *     file_shares=gcp.filestore.InstanceFileSharesArgs(
 *         capacity_gb=1024,
 *         name="share1",
 *     ),
 *     networks=[gcp.filestore.InstanceNetworkArgs(
 *         network="default",
 *         modes=["MODE_IPV4"],
 *     )],
 *     kms_key_name=filestore_key.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var filestoreKeyring = new Gcp.Kms.KeyRing("filestore_keyring", new()
 *     {
 *         Name = "filestore-keyring",
 *         Location = "us-central1",
 *     });
 *     var filestoreKey = new Gcp.Kms.CryptoKey("filestore_key", new()
 *     {
 *         Name = "filestore-key",
 *         KeyRing = filestoreKeyring.Id,
 *     });
 *     var instance = new Gcp.Filestore.Instance("instance", new()
 *     {
 *         Name = "test-instance",
 *         Location = "us-central1",
 *         Tier = "ENTERPRISE",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 1024,
 *             Name = "share1",
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *             },
 *         },
 *         KmsKeyName = filestoreKey.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		filestoreKeyring, err := kms.NewKeyRing(ctx, "filestore_keyring", &kms.KeyRingArgs{
 * 			Name:     pulumi.String("filestore-keyring"),
 * 			Location: pulumi.String("us-central1"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		filestoreKey, err := kms.NewCryptoKey(ctx, "filestore_key", &kms.CryptoKeyArgs{
 * 			Name:    pulumi.String("filestore-key"),
 * 			KeyRing: filestoreKeyring.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = filestore.NewInstance(ctx, "instance", &filestore.InstanceArgs{
 * 			Name:     pulumi.String("test-instance"),
 * 			Location: pulumi.String("us-central1"),
 * 			Tier:     pulumi.String("ENTERPRISE"),
 * 			FileShares: &filestore.InstanceFileSharesArgs{
 * 				CapacityGb: pulumi.Int(1024),
 * 				Name:       pulumi.String("share1"),
 * 			},
 * 			Networks: filestore.InstanceNetworkArray{
 * 				&filestore.InstanceNetworkArgs{
 * 					Network: pulumi.String("default"),
 * 					Modes: pulumi.StringArray{
 * 						pulumi.String("MODE_IPV4"),
 * 					},
 * 				},
 * 			},
 * 			KmsKeyName: filestoreKey.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.kms.KeyRing;
 * import com.pulumi.gcp.kms.KeyRingArgs;
 * import com.pulumi.gcp.kms.CryptoKey;
 * import com.pulumi.gcp.kms.CryptoKeyArgs;
 * import com.pulumi.gcp.filestore.Instance;
 * import com.pulumi.gcp.filestore.InstanceArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var filestoreKeyring = new KeyRing("filestoreKeyring", KeyRingArgs.builder()
 *             .name("filestore-keyring")
 *             .location("us-central1")
 *             .build());
 *         var filestoreKey = new CryptoKey("filestoreKey", CryptoKeyArgs.builder()
 *             .name("filestore-key")
 *             .keyRing(filestoreKeyring.id())
 *             .build());
 *         var instance = new Instance("instance", InstanceArgs.builder()
 *             .name("test-instance")
 *             .location("us-central1")
 *             .tier("ENTERPRISE")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(1024)
 *                 .name("share1")
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .build())
 *             .kmsKeyName(filestoreKey.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       name: test-instance
 *       location: us-central1
 *       tier: ENTERPRISE
 *       fileShares:
 *         capacityGb: 1024
 *         name: share1
 *       networks:
 *         - network: default
 *           modes:
 *             - MODE_IPV4
 *       kmsKeyName: ${filestoreKey.id}
 *   filestoreKeyring:
 *     type: gcp:kms:KeyRing
 *     name: filestore_keyring
 *     properties:
 *       name: filestore-keyring
 *       location: us-central1
 *   filestoreKey:
 *     type: gcp:kms:CryptoKey
 *     name: filestore_key
 *     properties:
 *       name: filestore-key
 *       keyRing: ${filestoreKeyring.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}}
 * ```
 */
public class Instance internal constructor(
    override val javaResource: com.pulumi.gcp.filestore.Instance,
) : KotlinCustomResource(javaResource, InstanceMapper) {
    /**
     * Creation timestamp in RFC3339 text format.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A description of the instance.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
     */
    public val effectiveLabels: Output>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Server-specified ETag for the instance resource to prevent
     * simultaneous updates from overwriting each other.
     */
    public val etag: Output
        get() = javaResource.etag().applyValue({ args0 -> args0 })

    /**
     * File system shares on the instance. For this version, only a
     * single file share is supported.
     * Structure is documented below.
     */
    public val fileShares: Output
        get() = javaResource.fileShares().applyValue({ args0 ->
            args0.let({ args0 ->
                instanceFileSharesToKotlin(args0)
            })
        })

    /**
     * KMS key name used for data encryption.
     */
    public val kmsKeyName: Output?
        get() = javaResource.kmsKeyName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Resource labels to represent user-provided metadata. **Note**: This field is non-authoritative, and will only manage the
     * labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the
     * resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The name of the location of the instance. This can be a region for ENTERPRISE tier instances.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the instance.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * VPC networks to which the instance is connected. For this version,
     * only a single network is supported.
     * Structure is documented below.
     */
    public val networks: Output>
        get() = javaResource.networks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    instanceNetworkToKotlin(args0)
                })
            })
        })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Either NFSv3, for using NFS version 3 as file sharing protocol, or NFSv4.1, for using NFS version 4.1 as file sharing
     * protocol. NFSv4.1 can be used with HIGH_SCALE_SSD, ZONAL, REGIONAL and ENTERPRISE. The default is NFSv3. Default value:
     * "NFS_V3" Possible values: ["NFS_V3", "NFS_V4_1"]
     */
    public val protocol: Output?
        get() = javaResource.protocol().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The service tier of the instance.
     * Possible values include: STANDARD, PREMIUM, BASIC_HDD, BASIC_SSD, HIGH_SCALE_SSD, ZONAL, REGIONAL and ENTERPRISE
     */
    public val tier: Output
        get() = javaResource.tier().applyValue({ args0 -> args0 })

    /**
     * The name of the Filestore zone of the instance.
     */
    @Deprecated(
        message = """
  `zone` is deprecated and will be removed in a future major release. Use `location` instead.
  """,
    )
    public val zone: Output
        get() = javaResource.zone().applyValue({ args0 -> args0 })
}

public object InstanceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.filestore.Instance::class == javaResource::class

    override fun map(javaResource: Resource): Instance = Instance(
        javaResource as
            com.pulumi.gcp.filestore.Instance,
    )
}

/**
 * @see [Instance].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Instance].
 */
public suspend fun instance(name: String, block: suspend InstanceResourceBuilder.() -> Unit): Instance {
    val builder = InstanceResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Instance].
 * @param name The _unique_ name of the resulting resource.
 */
public fun instance(name: String): Instance {
    val builder = InstanceResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy