Skip to content

Commit 0f34d1e

Browse files
authored
Small tweaks and cosmetics (#19)
* Small tweaks and cosmetics * Typo * Fixing examples
1 parent 1ae671d commit 0f34d1e

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656

5757
steps:
5858
- name: Create deploy-bucket
59-
uses: bitovi/[email protected].2
59+
uses: bitovi/[email protected].3
6060
with:
6161
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
6262
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -66,6 +66,7 @@ jobs:
6666
tf_state_bucket_destroy: true # If destroying, will remove the bucket
6767

6868
aws_site_cdn_enabled: true
69+
#aws_site_error_document: error.html # Optional error file
6970

7071
aws_r53_domain_name: example.com # You should own and have this domain available in R53
7172
aws_r53_sub_domain_name: site
@@ -84,7 +85,7 @@ jobs:
8485
runs-on: ubuntu-latest
8586
steps:
8687
- name: Create deploy-bucket
87-
uses: bitovi/[email protected].2
88+
uses: bitovi/[email protected].3
8889
with:
8990
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
9091
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -110,7 +111,7 @@ jobs:
110111
runs-on: ubuntu-latest
111112
steps:
112113
- name: Create deploy-bucket
113-
uses: bitovi/[email protected].2
114+
uses: bitovi/[email protected].3
114115
with:
115116
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
116117
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -181,7 +182,8 @@ The following inputs can be used as `step.with` keys
181182
| Name | Type | Description |
182183
|------------------|---------|------------------------------------|
183184
| `aws_site_source_folder` | String | Source folder for files to be published. Will ignore any hidden file. Defaults to root folder of the calling repo if nothing defined. |
184-
| `aws_site_root_object` | Boolean | Root object to be served as entry-point. Defaults to `index.html`. |
185+
| `aws_site_root_object` | String | Root object to be served as entry-point. Defaults to `index.html`. |
186+
| `aws_site_error_document` | String | Error document set to S3 website config. Defaults to none. Set value to enable it. |
185187
| `aws_site_bucket_name` | String | AWS S3 bucket name to use for the public files. Defaults to `${org}-${repo}-{branch}-sp`. If using a R53 domain and not a CDN, bucket name will be the FQDN one. See note. |
186188
| `aws_site_cdn_enabled` | Boolean | Enable or disables the use of CDN. Defaults to `false`. |
187189
| `aws_site_cdn_custom_error_codes` | JSON | Custom error codes to define in CDN. Like `[{\"error_caching_min_ttl\":\"0\",\"error_code\":\"403\",\"response_code\":\"200\",\"response_page_path\":\"/index.html\"}]`. See [this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution.html#custom-error-response-arguments). |

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ inputs:
5656
description: 'Root object to be served as entry-point. Defaults to `index.html`'
5757
required: false
5858
aws_site_error_document:
59-
description: 'Error document set to S3 website config. Defaults to `error.html`'
59+
description: 'Error document set to S3 website config. Defaults to none.'
6060
required: false
6161
aws_site_bucket_name:
6262
description: ' AWS S3 bucket name to use for the public files. Defaults to `${org}-${repo}-{branch}-sp`'

terraform_code/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ resource "aws_s3_bucket_website_configuration" "aws_site_website_bucket" {
1010
suffix = var.aws_site_root_object
1111
}
1212

13-
error_document {
14-
key = var.aws_site_error_document
13+
dynamic "error_document" {
14+
for_each = var.aws_site_error_document != "" ? [1] : []
15+
content {
16+
key = var.aws_site_error_document
17+
}
1518
}
1619
}
1720

terraform_code/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ variable "aws_site_root_object" {
3232
}
3333

3434
variable "aws_site_error_document" {
35-
description = "error document. Defaults to empty"
35+
description = "Error document. Defaults to none"
3636
type = string
3737
default = ""
3838
}

0 commit comments

Comments
 (0)