Skip to content

Commit 0686cec

Browse files
committed
Add public access prevention variable to bucket module
1 parent 9817c2f commit 0686cec

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

tf/bucket/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ resource "google_storage_bucket" "main" {
3131
location = var.location
3232

3333
force_destroy = var.force_destroy
34+
public_access_prevention = var.public_access_prevention
3435
uniform_bucket_level_access = true
3536

3637
dynamic "retention_policy" {

tf/bucket/variables.tf

+25-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
variable "admins" {
2+
description = "IAM-style members who will be granted roles/storage.objectAdmin on bucket."
3+
type = list(string)
4+
default = []
5+
}
16

2-
variable "name" {
3-
description = "The name of the bucket."
4-
type = string
7+
variable "force_destroy" {
8+
description = "When deleting a bucket, this boolean option will delete all contained objects. If you try to delete a bucket that contains objects, Terraform will fail that run."
9+
type = bool
10+
default = false
511
}
612

713
variable "location" {
@@ -10,23 +16,22 @@ variable "location" {
1016
default = "europe-west1"
1117
}
1218

13-
variable "force_destroy" {
14-
description = "When deleting a bucket, this boolean option will delete all contained objects. If you try to delete a bucket that contains objects, Terraform will fail that run."
15-
type = bool
16-
default = false
19+
variable "name" {
20+
description = "The name of the bucket."
21+
type = string
1722
}
1823

19-
20-
variable "admins" {
21-
description = "IAM-style members who will be granted roles/storage.objectAdmin on bucket."
22-
type = list(string)
23-
default = []
24+
variable "public_access_prevention" {
25+
description = "The public access prevention configuration for this bucket."
26+
type = string
27+
default = "inherited"
2428
}
2529

26-
variable "viewers" {
27-
description = "IAM-style members who will be granted roles/storage.objectViewer on bucket."
28-
type = list(string)
29-
default = []
30+
variable "retention_policy" {
31+
type = map(any)
32+
nullable = true
33+
default = null
34+
description = "Configuration of the bucket's data retention policy for how long objects in the bucket should be retained."
3035
}
3136

3237
variable "users" {
@@ -35,9 +40,8 @@ variable "users" {
3540
default = []
3641
}
3742

38-
variable "retention_policy" {
39-
type = map(any)
40-
nullable = true
41-
default = null
42-
description = "Configuration of the bucket's data retention policy for how long objects in the bucket should be retained."
43+
variable "viewers" {
44+
description = "IAM-style members who will be granted roles/storage.objectViewer on bucket."
45+
type = list(string)
46+
default = []
4347
}

0 commit comments

Comments
 (0)