blob: d10b1898705bb536e7722bcb826d505a76963110 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** 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: "Cloud Storage"
description: |-
A Google Cloud Storage Managed Folder.
---
# google_storage_managed_folder
A Google Cloud Storage Managed Folder.
You can apply Identity and Access Management (IAM) policies to
managed folders to grant principals access only to the objects
within the managed folder, which lets you more finely control access
for specific data sets and tables within a bucket. You can nest
managed folders up to 15 levels deep, including the parent managed
folder.
Managed folders can only be created in buckets that have uniform
bucket-level access enabled.
To get more information about ManagedFolder, see:
* [API documentation](https://cloud.google.com/storage/docs/json_api/v1/managedFolder)
* How-to Guides
* [Official Documentation](https://cloud.google.com/storage/docs/managed-folders)
<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=storage_managed_folder_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 - Storage Managed Folder Basic
```hcl
resource "google_storage_bucket" "bucket" {
name = "my-bucket"
location = "EU"
uniform_bucket_level_access = true
}
resource "google_storage_managed_folder" "folder" {
bucket = google_storage_bucket.bucket.name
name = "managed/folder/name/"
force_destroy = true
}
```
## Argument Reference
The following arguments are supported:
* `bucket` -
(Required)
The name of the bucket that contains the managed folder.
* `name` -
(Required)
The name of the managed folder expressed as a path. Must include
trailing '/'. For example, `example_dir/example_dir2/`.
- - -
* `force_destroy` - (Optional) Allows the deletion of a managed folder even if contains
objects. If a non-empty managed folder is deleted, any objects
within the folder will remain in a simulated folder with the
same name.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `{{bucket}}/{{name}}`
* `create_time` -
The timestamp at which this managed folder was created.
* `update_time` -
The timestamp at which this managed folder was most recently updated.
* `metageneration` -
The metadata generation of the managed folder.
* `self_link` - The URI of the created resource.
## 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
ManagedFolder can be imported using any of these accepted formats:
* `{{bucket}}/managedFolders/{{name}}`
* `{{bucket}}/{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import ManagedFolder using one of the formats above. For example:
```tf
import {
id = "{{bucket}}/managedFolders/{{name}}"
to = google_storage_managed_folder.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), ManagedFolder can be imported using one of the formats above. For example:
```
$ terraform import google_storage_managed_folder.default {{bucket}}/managedFolders/{{name}}
$ terraform import google_storage_managed_folder.default {{bucket}}/{{name}}
```