Skip to content

Commit

Permalink
feat: add support for website configuration to simple_bucket submodule (
Browse files Browse the repository at this point in the history
#150)

Signed-off-by: Danny Rehelis <[email protected]>
  • Loading branch information
drehelis authored Mar 4, 2022
1 parent a8aa700 commit 839a18c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/simple_bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Functional examples are included in the
| retention\_policy | Configuration of the bucket's data retention policy for how long objects in the bucket should be retained. | <pre>object({<br> is_locked = bool<br> retention_period = number<br> })</pre> | `null` | no |
| storage\_class | The Storage Class of the new bucket. | `string` | `null` | no |
| versioning | While set to true, versioning is fully enabled for this bucket. | `bool` | `true` | no |
| website | Map of website values. Supported attributes: main\_page\_suffix, not\_found\_page | `map(any)` | `{}` | no |

## Outputs

Expand Down
8 changes: 8 additions & 0 deletions modules/simple_bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ resource "google_storage_bucket" "bucket" {
}
}

dynamic "website" {
for_each = length(keys(var.website)) == 0 ? toset([]) : toset([var.website])
content {
main_page_suffix = lookup(website.value, "main_page_suffix", null)
not_found_page = lookup(website.value, "not_found_page", null)
}
}

dynamic "cors" {
for_each = var.cors == null ? [] : var.cors
content {
Expand Down
6 changes: 6 additions & 0 deletions modules/simple_bucket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,9 @@ variable "log_object_prefix" {
type = string
default = null
}

variable "website" {
type = map(any)
default = {}
description = "Map of website values. Supported attributes: main_page_suffix, not_found_page"
}

0 comments on commit 839a18c

Please sign in to comment.