| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** 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 snapshot. |
| --- |
| |
| # google_filestore_snapshot |
| |
| A Google Cloud Filestore snapshot. |
| |
| |
| To get more information about Snapshot, see: |
| |
| * [API documentation](https://cloud.google.com/filestore/docs/reference/rest/v1/projects.locations.instances.snapshots) |
| * How-to Guides |
| * [Creating Snapshots](https://cloud.google.com/filestore/docs/create-snapshots) |
| * [Official Documentation](https://cloud.google.com/filestore/docs/snapshots) |
| |
| <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_snapshot_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 Snapshot Basic |
| |
| |
| ```hcl |
| resource "google_filestore_snapshot" "snapshot" { |
| name = "test-snapshot" |
| instance = google_filestore_instance.instance.name |
| location = "us-east1" |
| } |
| |
| resource "google_filestore_instance" "instance" { |
| name = "test-instance-for-snapshot" |
| location = "us-east1" |
| tier = "ENTERPRISE" |
| |
| 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_snapshot_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 Snapshot Full |
| |
| |
| ```hcl |
| resource "google_filestore_snapshot" "snapshot" { |
| name = "test-snapshot" |
| instance = google_filestore_instance.instance.name |
| location = "us-west1" |
| |
| description = "Snapshot of test-instance-for-snapshot" |
| |
| labels = { |
| my_label = "value" |
| } |
| } |
| |
| resource "google_filestore_instance" "instance" { |
| name = "test-instance-for-snapshot" |
| location = "us-west1" |
| tier = "ENTERPRISE" |
| |
| file_shares { |
| capacity_gb = 1024 |
| name = "share1" |
| } |
| |
| networks { |
| network = "default" |
| modes = ["MODE_IPV4"] |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `name` - |
| (Required) |
| The resource name of the snapshot. The name must be unique within the specified instance. |
| The name must be 1-63 characters long, and comply with |
| RFC1035. Specifically, the name must be 1-63 characters long and match |
| the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the |
| first character must be a lowercase letter, and all following |
| characters must be a dash, lowercase letter, or digit, except the last |
| character, which cannot be a dash. |
| |
| * `location` - |
| (Required) |
| The name of the location of the instance. This can be a region for ENTERPRISE tier instances. |
| |
| * `instance` - |
| (Required) |
| The resource name of the filestore instance. |
| |
| |
| - - - |
| |
| |
| * `description` - |
| (Optional) |
| A description of the snapshot with 2048 characters or less. Requests with longer descriptions will be rejected. |
| |
| * `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. |
| |
| * `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/{{instance}}/snapshots/{{name}}` |
| |
| * `state` - |
| The snapshot state. |
| |
| * `create_time` - |
| The time when the snapshot was created in RFC3339 text format. |
| |
| * `filesystem_used_bytes` - |
| The amount of bytes needed to allocate a full copy of the snapshot content. |
| |
| * `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 |
| |
| |
| Snapshot can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/{{location}}/instances/{{instance}}/snapshots/{{name}}` |
| * `{{project}}/{{location}}/{{instance}}/{{name}}` |
| * `{{location}}/{{instance}}/{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Snapshot using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{location}}/instances/{{instance}}/snapshots/{{name}}" |
| to = google_filestore_snapshot.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Snapshot can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_filestore_snapshot.default projects/{{project}}/locations/{{location}}/instances/{{instance}}/snapshots/{{name}} |
| $ terraform import google_filestore_snapshot.default {{project}}/{{location}}/{{instance}}/{{name}} |
| $ terraform import google_filestore_snapshot.default {{location}}/{{instance}}/{{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). |