Skip to content

googleFilestoreInstance

A Google Cloud Filestore instance.

To get more information about Instance, see:

Example Usage - Filestore Instance Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.filestoreInstance.FilestoreInstance(this, "instance", {
  file_shares: [
    {
      capacity_gb: 2660,
      name: "share1",
    },
  ],
  location: "us-central1-b",
  name: "test-instance",
  networks: [
    {
      modes: ["MODE_IPV4"],
      network: "default",
    },
  ],
  tier: "PREMIUM",
});

Example Usage - Filestore Instance Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.filestoreInstance.FilestoreInstance(this, "instance", {
  file_shares: [
    {
      capacity_gb: 2660,
      name: "share1",
      nfs_export_options: [
        {
          access_mode: "READ_WRITE",
          ip_ranges: ["10.0.0.0/24"],
          squash_mode: "NO_ROOT_SQUASH",
        },
        {
          access_mode: "READ_ONLY",
          anon_gid: 456,
          anon_uid: 123,
          ip_ranges: ["10.10.0.0/24"],
          squash_mode: "ROOT_SQUASH",
        },
      ],
    },
  ],
  location: "us-central1-b",
  name: "test-instance",
  networks: [
    {
      connect_mode: "DIRECT_PEERING",
      modes: ["MODE_IPV4"],
      network: "default",
    },
  ],
  tier: "BASIC_SSD",
});

Example Usage - Filestore Instance Enterprise

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleKmsKeyRingFilestoreKeyring = new google.kmsKeyRing.KmsKeyRing(
  this,
  "filestore_keyring",
  {
    location: "us-central1",
    name: "filestore-keyring",
  }
);
const googleKmsCryptoKeyFilestoreKey = new google.kmsCryptoKey.KmsCryptoKey(
  this,
  "filestore_key",
  {
    key_ring: googleKmsKeyRingFilestoreKeyring.id,
    name: "filestore-key",
  }
);
new google.filestoreInstance.FilestoreInstance(this, "instance", {
  file_shares: [
    {
      capacity_gb: 2560,
      name: "share1",
    },
  ],
  kms_key_name: googleKmsCryptoKeyFilestoreKey.id,
  location: "us-central1",
  name: "test-instance",
  networks: [
    {
      modes: ["MODE_IPV4"],
      network: "default",
    },
  ],
  tier: "ENTERPRISE",
});

Argument Reference

The following arguments are supported:

  • name - (Required) The resource name of the instance.

  • tier - (Required) The service tier of the instance. Possible values include: STANDARD, PREMIUM, BASIC_HDD, BASIC_SSD, HIGH_SCALE_SSD and ENTERPRISE

  • fileShares - (Required) File system shares on the instance. For this version, only a single file share is supported. Structure is documented below.

  • networks - (Required) VPC networks to which the instance is connected. For this version, only a single network is supported. Structure is documented below.

The fileShares block supports:

  • name - (Required) The name of the fileshare (16 characters or less)

  • capacityGb - (Required) File share capacity in GiB. This must be at least 1024 GiB for the standard tier, or 2560 GiB for the premium tier.

  • sourceBackup - (Output) The resource name of the backup, in the format projects/{projectId}/locations/{locationId}/backups/{backupId}, that this file share has been restored from.

  • nfsExportOptions - (Optional) Nfs Export Options. There is a limit of 10 export options per file share. Structure is documented below.

The nfsExportOptions block supports:

  • ipRanges - (Optional) List of either IPv4 addresses, or ranges in CIDR notation which may mount the file share. Overlapping IP ranges are not allowed, both within and across NfsExportOptions. An error will be returned. The limit is 64 IP ranges/addresses for each FileShareConfig among all NfsExportOptions.

  • accessMode - (Optional) Either READ_ONLY, for allowing only read requests on the exported directory, or READ_WRITE, for allowing both read and write requests. The default is READ_WRITE. Default value is readWrite. Possible values are readOnly and readWrite.

  • squashMode - (Optional) Either NO_ROOT_SQUASH, for allowing root access on the exported directory, or ROOT_SQUASH, for not allowing root access. The default is NO_ROOT_SQUASH. Default value is noRootSquash. Possible values are noRootSquash and rootSquash.

  • anonUid - (Optional) An integer representing the anonymous user id with a default value of 65534. Anon_uid may only be set with squashMode of ROOT_SQUASH. An error will be returned if this field is specified for other squashMode settings.

  • anonGid - (Optional) An integer representing the anonymous group id with a default value of 65534. Anon_gid may only be set with squashMode of ROOT_SQUASH. An error will be returned if this field is specified for other squashMode settings.

The networks block supports:

  • network - (Required) The name of the GCE VPC network to which the instance is connected.

  • modes - (Required) IP versions for which the instance has IP addresses assigned. Each value may be one of addressModeUnspecified, modeIpv4, and modeIpv6.

  • reservedIpRange - (Optional) A /29 CIDR block that identifies the range of IP addresses reserved for this instance.

  • ipAddresses - (Output) A list of IPv4 or IPv6 addresses.

  • connectMode - (Optional) The network connect mode of the Filestore instance. If not provided, the connect mode defaults to DIRECT_PEERING. Default value is directPeering. Possible values are directPeering and privateServiceAccess.


  • description - (Optional) A description of the instance.

  • labels - (Optional) Resource labels to represent user-provided metadata.

  • kmsKeyName - (Optional) KMS key name used for data encryption.

  • zone - (Optional, Deprecated) The name of the Filestore zone of the instance.

  • location - (Optional) The name of the location of the instance. This can be a region for ENTERPRISE tier instances.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{location}}/instances/{{name}}

  • createTime - Creation timestamp in RFC3339 text format.

  • etag - Server-specified ETag for the instance resource to prevent simultaneous updates from overwriting each other.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Instance can be imported using any of these accepted formats:

$ terraform import google_filestore_instance.default projects/{{project}}/locations/{{location}}/instances/{{name}}
$ terraform import google_filestore_instance.default {{project}}/{{location}}/{{name}}
$ terraform import google_filestore_instance.default {{location}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.