From 7dad4496b4d3c049899945c19b6202995df2c361 Mon Sep 17 00:00:00 2001
From: Caio Tavares <89272600+caiotavaresdito@users.noreply.github.com>
Date: Thu, 14 Oct 2021 14:11:26 -0400
Subject: [PATCH 1/3] Feature/added gcs website (#325)
* Added GCS website block support
* Terraform linting
* Moved variable to last and re-generated README
---
modules/gcs/README.md | 1 +
modules/gcs/main.tf | 9 +++++++++
modules/gcs/variables.tf | 9 +++++++++
3 files changed, 19 insertions(+)
diff --git a/modules/gcs/README.md b/modules/gcs/README.md
index 095bb1059..3bd174b60 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 26fb66277..b1e9a548c 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 b2ff053eb..6433ed09a 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
From 8bb44212dc5ee66d1f7a9973604ade936547da22 Mon Sep 17 00:00:00 2001
From: Ludovico Magnocavallo
Date: Thu, 14 Oct 2021 20:12:03 +0200
Subject: [PATCH 2/3] Update CHANGELOG.md
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf0baa707..550698fec 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
From dcb1e3209782c09def3c877069a64293218d96c3 Mon Sep 17 00:00:00 2001
From: Ludovico Magnocavallo
Date: Thu, 14 Oct 2021 20:15:31 +0200
Subject: [PATCH 3/3] update test params after README fix
---
modules/organization/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/organization/README.md b/modules/organization/README.md
index 5ad938366..5e60be8ca 100644
--- a/modules/organization/README.md
+++ b/modules/organization/README.md
@@ -32,7 +32,7 @@ module "org" {
}
}
}
-# tftest:modules=1:resources=5
+# tftest:modules=1:resources=6
```
## IAM