Aller au contenu

Bucket

Requirements

Name Version
terraform >= 1.3.5, < 2
google >= 6.36.1, < 7

Providers

Name Version
google >= 6.36.1, < 7

Modules

No modules.

Resources

Name Type
google_storage_bucket.bucket resource
google_storage_bucket_iam_member.members resource

Inputs

Name Description Type Default Required
bucket_policy_only Enables Bucket Policy Only access to a bucket. bool true no
cors Configuration of CORS for bucket with structure as defined in https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket#cors. any [] no
encryption A Cloud KMS key that will be used to encrypt objects inserted into this bucket
object({
default_kms_key_name = string
})
null no
force_destroy When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. bool false no
iam_members The list of IAM members to grant permissions on the bucket.
list(object({
role = string
member = string
}))
[] no
labels A set of key/value label pairs to assign to the bucket. map(string) null no
lifecycle_rules The bucket's Lifecycle Rules configuration.
list(object({
# Object with keys:
# - type - The type of the action of this Lifecycle Rule. Supported values: Delete and SetStorageClass.
# - storage_class - (Required if action type is SetStorageClass) The target Storage Class of objects affected by this Lifecycle Rule.
action = any

# Object with keys:
# - age - (Optional) Minimum age of an object in days to satisfy this condition.
# - created_before - (Optional) Creation date of an object in RFC 3339 (e.g. 2017-06-13) to satisfy this condition.
# - with_state - (Optional) Match to live and/or archived objects. Supported values include: "LIVE", "ARCHIVED", "ANY".
# - matches_storage_class - (Optional) Storage Class of objects to satisfy this condition. Supported values include: MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, STANDARD, DURABLE_REDUCED_AVAILABILITY.
# - num_newer_versions - (Optional) Relevant only for versioned objects. The number of newer versions of an object to satisfy this condition.
condition = any
}))
[] no
location The location of the bucket. string n/a yes
log_bucket The bucket that will receive log objects. string null no
log_object_prefix The object prefix for log objects. If it's not provided, by default GCS sets this to this bucket's name string null no
name The name of the bucket. string n/a yes
project_id The ID of the project to create the bucket in. string n/a yes
retention_policy Configuration of the bucket's data retention policy for how long objects in the bucket should be retained.
object({
is_locked = bool
retention_period = number
})
null no
storage_class The Storage Class of the new bucket. string null no
versioning While set to true, versioning is fully enabled for this bucket. bool true no
website Map of website values. Supported attributes: main_page_suffix, not_found_page map(any) {} no

Outputs

Name Description
bucket The created storage bucket
name Bucket name
url Bucket URL