# storage.tf ## set a bucket for static site resource "google_storage_bucket" "static-site" { name = "image-store.com" location = "US" force_destroy = true uniform_bucket_level_access = true website { main_page_suffix = "index.html" not_found_page = "404.html" } cors { origin = ["http://image-store.com"] response_header = ["*"] max_age_seconds = 3600 } }
## set public access control for static site resource "google_storage_bucket_iam_binding" "public_binding" { bucket = google_storage_bucket.static-site.name role = "roles/storage.objectViewer" members = [ "allUsers", ] }