Skip to content

Commit

Permalink
Ability to specify website hosting configuration (#91)
Browse files Browse the repository at this point in the history
* Ability to specify website hosting configuration

* Github Actions and Readme/docs regenerated
  • Loading branch information
azec-pdx authored Jun 7, 2021
1 parent 1d52711 commit e9eae04
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ template: |
replacers:
# Remove irrelevant information from Renovate bot
- search: '/---\s+^#.*Renovate configuration(?:.|\n)*?This PR has been generated .*/gm'
- search: '/(?<=---\s+)+^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
replace: ''
# Remove Renovate bot banner image
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: auto-release
on:
push:
branches:
- main
- master
- production

jobs:
publish:
Expand All @@ -14,7 +16,7 @@ jobs:
id: get-merged-pull-request
with:
github_token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
# Drafts your next Release notes as Pull Requests are merged into "master"
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
if: "!contains(steps.get-merged-pull-request.outputs.labels, 'no-release')"
with:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ Available targets:
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
| <a name="input_user_enabled"></a> [user\_enabled](#input\_user\_enabled) | Set to `true` to create an IAM user with permission to access the bucket | `bool` | `false` | no |
| <a name="input_versioning_enabled"></a> [versioning\_enabled](#input\_versioning\_enabled) | A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket | `bool` | `true` | no |
| <a name="input_website_inputs"></a> [website\_inputs](#input\_website\_inputs) | Specifies the static website hosting configuration object. | <pre>list(object({<br> index_document = string<br> error_document = string<br> redirect_all_requests_to = string<br> routing_rules = string<br> }))</pre> | `null` | no |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `map('BusinessUnit','XYZ')` | `map(string)` | `{}` | no |
| <a name="input_user_enabled"></a> [user\_enabled](#input\_user\_enabled) | Set to `true` to create an IAM user with permission to access the bucket | `bool` | `false` | no |
| <a name="input_versioning_enabled"></a> [versioning\_enabled](#input\_versioning\_enabled) | A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket | `bool` | `true` | no |
| <a name="input_website_inputs"></a> [website\_inputs](#input\_website\_inputs) | Specifies the static website hosting configuration object. | <pre>list(object({<br> index_document = string<br> error_document = string<br> redirect_all_requests_to = string<br> routing_rules = string<br> }))</pre> | `null` | no |

## Outputs

Expand Down
10 changes: 10 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ resource "aws_s3_bucket" "default" {
}
}

dynamic "website" {
for_each = var.website_inputs == null ? [] : var.website_inputs
content {
index_document = website.value.index_document
error_document = website.value.error_document
redirect_all_requests_to = website.value.redirect_all_requests_to
routing_rules = website.value.routing_rules
}
}

dynamic "cors_rule" {
for_each = var.cors_rule_inputs == null ? [] : var.cors_rule_inputs

Expand Down
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,17 @@ variable "object_lock_configuration" {
})
default = null
description = "A configuration for S3 object locking. With S3 Object Lock, you can store objects using a `write once, read many` (WORM) model. Object Lock can help prevent objects from being deleted or overwritten for a fixed amount of time or indefinitely."
}

variable "website_inputs" {

type = list(object({
index_document = string
error_document = string
redirect_all_requests_to = string
routing_rules = string
}))
default = null

description = "Specifies the static website hosting configuration object."
}

0 comments on commit e9eae04

Please sign in to comment.