From 39d68a5f687addb7e041a4c47917e717a82e8b81 Mon Sep 17 00:00:00 2001 From: Vinicius Date: Wed, 4 Oct 2023 19:58:43 -0300 Subject: [PATCH] feat: add website public bucket --- terraform/cloud_storage/main.tf | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/terraform/cloud_storage/main.tf b/terraform/cloud_storage/main.tf index b3d122d..b59435a 100644 --- a/terraform/cloud_storage/main.tf +++ b/terraform/cloud_storage/main.tf @@ -13,3 +13,24 @@ resource "google_storage_bucket" "website_images" { enabled = var.bucket_versioning } } + +resource "google_storage_bucket" "website" { + name = var.bucket_name + location = var.bucket_location + storage_class = var.bucket_storage_class + force_destroy = var.bucket_force_destroy + uniform_bucket_level_access = var.bucket_uniform_bucket_level_access + + versioning { + enabled = var.bucket_versioning + } +} + +resource "google_storage_bucket_iam_binding" "all_users_read" { + bucket = google_storage_bucket.website.name + role = "roles/storage.objectViewer" + + members = [ + "allUsers", + ] +}