diff --git a/CHANGELOG.md b/CHANGELOG.md index cf0baa70..550698fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - **incompatible change** the format of the `records` variable in the `dns` module has changed, to better support dynamic values - new `naming-convention` module - new `cloudsql-instance` module +- added support for website to `gcs` module ## [6.0.0] - 2021-10-04 diff --git a/modules/gcs/README.md b/modules/gcs/README.md index 095bb105..3bd174b6 100644 --- a/modules/gcs/README.md +++ b/modules/gcs/README.md @@ -114,6 +114,7 @@ module "bucket" { | *storage_class* | Bucket storage class. | string | | ... | | *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 | | *versioning* | Enable versioning, defaults to false. | bool | | false | +| *website* | Bucket website. | object({...}) | | null | ## Outputs diff --git a/modules/gcs/main.tf b/modules/gcs/main.tf index 26fb6627..b1e9a548 100644 --- a/modules/gcs/main.tf +++ b/modules/gcs/main.tf @@ -38,6 +38,15 @@ resource "google_storage_bucket" "bucket" { storage_class = lower(var.storage_class) }) + dynamic "website" { + for_each = var.website == null ? [] : [""] + + content { + main_page_suffix = var.website.main_page_suffix + not_found_page = var.website.not_found_page + } + } + dynamic "encryption" { for_each = var.encryption_key == null ? [] : [""] diff --git a/modules/gcs/variables.tf b/modules/gcs/variables.tf index b2ff053e..6433ed09 100644 --- a/modules/gcs/variables.tf +++ b/modules/gcs/variables.tf @@ -132,3 +132,12 @@ variable "versioning" { type = bool default = false } + +variable "website" { + description = "Bucket website." + type = object({ + main_page_suffix = string + not_found_page = string + }) + default = null +} \ No newline at end of file