| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Filestore" |
| description: |- |
| A Google Cloud Filestore instance. |
| --- |
| |
| # google_filestore_instance |
| |
| 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) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=filestore_instance_basic&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Filestore Instance Basic |
| |
| |
| ```hcl |
| 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"] |
| } |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=filestore_instance_full&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Filestore Instance Full |
| |
| |
| ```hcl |
| 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" |
| } |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=filestore_instance_protocol&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Filestore Instance Protocol |
| |
| |
| ```hcl |
| 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 |
| |
| |
| ```hcl |
| 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: |
| |
| |
| * `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, ZONAL, REGIONAL and ENTERPRISE |
| |
| * `file_shares` - |
| (Required) |
| File system shares on the instance. For this version, only a |
| single file share is supported. |
| Structure is [documented below](#nested_file_shares). |
| |
| * `networks` - |
| (Required) |
| VPC networks to which the instance is connected. For this version, |
| only a single network is supported. |
| Structure is [documented below](#nested_networks). |
| |
| |
| <a name="nested_file_shares"></a>The `file_shares` block supports: |
| |
| * `name` - |
| (Required) |
| The name of the fileshare (16 characters or less) |
| |
| * `capacity_gb` - |
| (Required) |
| File share capacity in GiB. This must be at least 1024 GiB |
| for the standard tier, or 2560 GiB for the premium tier. |
| |
| * `source_backup` - |
| (Optional) |
| The resource name of the backup, in the format |
| projects/{projectId}/locations/{locationId}/backups/{backupId}, |
| that this file share has been restored from. |
| |
| * `nfs_export_options` - |
| (Optional) |
| Nfs Export Options. There is a limit of 10 export options per file share. |
| Structure is [documented below](#nested_nfs_export_options). |
| |
| |
| <a name="nested_nfs_export_options"></a>The `nfs_export_options` block supports: |
| |
| * `ip_ranges` - |
| (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. |
| |
| * `access_mode` - |
| (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 `READ_WRITE`. |
| Possible values are: `READ_ONLY`, `READ_WRITE`. |
| |
| * `squash_mode` - |
| (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 `NO_ROOT_SQUASH`. |
| Possible values are: `NO_ROOT_SQUASH`, `ROOT_SQUASH`. |
| |
| * `anon_uid` - |
| (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. |
| |
| * `anon_gid` - |
| (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. |
| |
| <a name="nested_networks"></a>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: `ADDRESS_MODE_UNSPECIFIED`, `MODE_IPV4`, `MODE_IPV6`. |
| |
| * `reserved_ip_range` - |
| (Optional) |
| A /29 CIDR block that identifies the range of IP |
| addresses reserved for this instance. |
| |
| * `ip_addresses` - |
| (Output) |
| A list of IPv4 or IPv6 addresses. |
| |
| * `connect_mode` - |
| (Optional) |
| The network connect mode of the Filestore instance. |
| If not provided, the connect mode defaults to |
| DIRECT_PEERING. |
| Default value is `DIRECT_PEERING`. |
| Possible values are: `DIRECT_PEERING`, `PRIVATE_SERVICE_ACCESS`. |
| |
| - - - |
| |
| |
| * `description` - |
| (Optional) |
| A description of the instance. |
| |
| * `protocol` - |
| (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) |
| 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 is `NFS_V3`. |
| Possible values are: `NFS_V3`, `NFS_V4_1`. |
| |
| * `labels` - |
| (Optional) |
| 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. |
| |
| * `kms_key_name` - |
| (Optional) |
| KMS key name used for data encryption. |
| |
| * `zone` - |
| (Optional, Deprecated) |
| The name of the Filestore zone of the instance. |
| |
| ~> **Warning:** `zone` is deprecated and will be removed in a future major release. Use `location` instead. |
| |
| * `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}}` |
| |
| * `create_time` - |
| Creation timestamp in RFC3339 text format. |
| |
| * `etag` - |
| Server-specified ETag for the instance resource to prevent |
| simultaneous updates from overwriting each other. |
| |
| * `terraform_labels` - |
| The combination of labels configured directly on the resource |
| and default labels configured on the provider. |
| |
| * `effective_labels` - |
| All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-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: |
| |
| * `projects/{{project}}/locations/{{location}}/instances/{{name}}` |
| * `{{project}}/{{location}}/{{name}}` |
| * `{{location}}/{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Instance using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{location}}/instances/{{name}}" |
| to = google_filestore_instance.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |