google_filestore_instance

A Google Cloud Filestore instance.

To get more information about Instance, see:

Open in Cloud Shell

Example Usage - Filestore Instance Basic

resource "google_filestore_instance" "instance" {
  name     = "test-instance"
  location = "us-central1-b"
  tier     = "BASIC_HDD"

  file_shares {
    capacity_gb = 1024
    name        = "share1"
  }

  networks {
    network = "default"
    modes   = ["MODE_IPV4"]
  }
}
Open in Cloud Shell

Example Usage - Filestore Instance Full

resource "google_filestore_instance" "instance" {
  name     = "test-instance"
  location = "us-central1-b"
  tier     = "BASIC_SSD"

  file_shares {
    capacity_gb = 2560
    name        = "share1"

    nfs_export_options {
      ip_ranges   = ["10.0.0.0/24"]
      access_mode = "READ_WRITE"
      squash_mode = "NO_ROOT_SQUASH"
    }

    nfs_export_options {
      ip_ranges   = ["10.10.0.0/24"]
      access_mode = "READ_ONLY"
      squash_mode = "ROOT_SQUASH"
      anon_uid    = 123
      anon_gid    = 456
    }
  }

  networks {
    network      = "default"
    modes        = ["MODE_IPV4"]
    connect_mode = "DIRECT_PEERING"
  }
}
Open in Cloud Shell

Example Usage - Filestore Instance Protocol

resource "google_filestore_instance" "instance" {
  provider = google-beta
  name     = "test-instance"
  location = "us-central1"
  tier     = "ENTERPRISE"
  protocol = "NFS_V4_1"

  file_shares {
    capacity_gb = 1024
    name        = "share1"
  }

  networks {
    network = "default"
    modes   = ["MODE_IPV4"]
  }

}

Example Usage - Filestore Instance Enterprise

resource "google_filestore_instance" "instance" {
  name     = "test-instance"
  location = "us-central1"
  tier     = "ENTERPRISE"

  file_shares {
    capacity_gb = 1024
    name        = "share1"
  }

  networks {
    network = "default"
    modes   = ["MODE_IPV4"]
  }

  kms_key_name = google_kms_crypto_key.filestore_key.id
}

resource "google_kms_key_ring" "filestore_keyring" {
  name     = "filestore-keyring"
  location = "us-central1"
}

resource "google_kms_crypto_key" "filestore_key" {
  name            = "filestore-key"
  key_ring        = google_kms_key_ring.filestore_keyring.id
}

Argument Reference

The following arguments are supported:

The file_shares block supports:

The nfs_export_options block supports:

The networks block supports:


Attributes Reference

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

Timeouts

This resource provides the following Timeouts configuration options:

Import

Instance can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Instance using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/instances/{{name}}"
  to = google_filestore_instance.default
}

When using the terraform import command, Instance can be imported using one of the formats above. For example:

$ 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.