File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ resource "random_id" "bucket_prefix" {
2323}
2424
2525resource "google_storage_bucket" "static_website" {
26- name = " ${ random_id . bucket_prefix . hex } -static-website-bucket"
27- location = " US"
28- storage_class = " STANDARD"
26+ name = " ${ random_id . bucket_prefix . hex } -static-website-bucket"
27+ location = " US"
28+ storage_class = " STANDARD"
29+ uniform_bucket_level_access = true
2930 website {
3031 main_page_suffix = " index.html"
3132 not_found_page = " 404.html"
@@ -34,11 +35,11 @@ resource "google_storage_bucket" "static_website" {
3435# [END storage_static_website_create_bucket_tf]
3536
3637# [START storage_static_website_make_bucket_public_tf]
37- # Make bucket public by granting allUsers READER access
38- resource "google_storage_bucket_access_control " "public_rule" {
39- bucket = google_storage_bucket. static_website . id
40- role = " READER "
41- entity = " allUsers"
38+ # Make bucket public by granting allUsers storage.objectViewer access
39+ resource "google_storage_bucket_iam_member " "public_rule" {
40+ bucket = google_storage_bucket. static_website . name
41+ role = " roles/storage.objectViewer "
42+ member = " allUsers"
4243}
4344# [END storage_static_website_make_bucket_public_tf]
4445
You can’t perform that action at this time.
0 commit comments