Original Module from Cloud-Foundation-Fabric
To use an existing encryption key, you have to grant permission to your Cloud Storage Agent which is automated by Terraform.
The Key and the Bucket must be in the same location!
This Module creates a GCP Storage Bucket
provider "google" {
project = var.project_id
user_project_override = true
billing_project = var.project_id
}
resource "random_string" "bucket_name" {
length = 8
special = false
upper = false
}
module "bucket" {
source = "../.."
project_id = var.project_id
name = random_string.bucket_name.result
}
Name | Version |
---|---|
terraform | >= 1.3.1 |
>= 4.40.0 | |
google-beta | >= 4.40.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | Bucket name suffix. | string |
n/a | yes |
project_id | Bucket project id. | string |
n/a | yes |
cors | CORS configuration for the bucket. Defaults to null. | object({ |
null |
no |
encryption_key | KMS key that will be used for encryption. | string |
null |
no |
force_destroy | Optional map to set force destroy keyed by name, defaults to false. | bool |
false |
no |
iam | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) |
{} |
no |
labels | Labels to be attached to all buckets. | map(string) |
{} |
no |
lifecycle_rule | Bucket lifecycle rule. | object({ |
null |
no |
location | Bucket location. | string |
"EU" |
no |
logging_config | Bucket logging configuration. | object({ |
null |
no |
notification_config | GCS Notification configuration. | object({ |
null |
no |
prefix | Optional prefix used to generate the bucket name. | string |
null |
no |
retention_policy | Bucket retention policy. | object({ |
null |
no |
storage_class | Bucket storage class. | string |
"MULTI_REGIONAL" |
no |
uniform_bucket_level_access | Allow using object ACLs (false) or not (true, this is the recommended behavior) , defaults to true (which is the recommended practice, but not the behavior of storage API). | bool |
true |
no |
versioning | Enable versioning, defaults to false. | bool |
false |
no |
website | Bucket website. | object({ |
null |
no |
Name | Description |
---|---|
bucket | Bucket resource. |
id | Bucket ID (same as name). |
name | Bucket name. |
notification | GCS Notification self link. |
topic | Topic ID used by GCS. |
url | Bucket URL. |
Type | Used |
---|---|
google_pubsub_topic | 1 |
google_pubsub_topic_iam_binding | 1 |
google_storage_bucket | 1 |
google_storage_bucket_iam_binding | 1 |
google_storage_notification | 1 |
Used only includes resource blocks. for_each and count meta arguments, as well as resource blocks of modules are not considered. |
No modules.
Name | Type |
---|---|
google_pubsub_topic.topic | resource |
google_pubsub_topic_iam_binding.binding | resource |
google_storage_bucket.bucket | resource |
google_storage_bucket_iam_binding.bindings | resource |
google_storage_notification.notification | resource |
This module is derived from google cloud foundation fabric module gcs
v19. It is designed to be able to integrate new changes from the base repository. Refer to guide in terraform-google-landing-zone
repository for information on integrating changes.