Skip to content

Commit

Permalink
Merge pull request #13 from Flaconi/plt-0-allow-default-root-object
Browse files Browse the repository at this point in the history
PLT-0 - Allow to set default root object
  • Loading branch information
Engerim authored Dec 22, 2023
2 parents c9d585d + 3a56535 commit 0c844a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ This module will create cdn endpoint with alias and SSL-certificate and optional
| <a name="input_r53_zone_id"></a> [r53\_zone\_id](#input\_r53\_zone\_id) | Route53 zone ID to be used for hostname and certificate validation | `string` | n/a | yes |
| <a name="input_cdn_logging"></a> [cdn\_logging](#input\_cdn\_logging) | Prefix in s3 bucket for cdn logs | `string` | `""` | no |
| <a name="input_cf_functions"></a> [cf\_functions](#input\_cf\_functions) | The Cloud Front function configuration<br> {type = object{}} ie. {"viewer-request" = object{}}<br> *type:*<br> Allowed cf event types are viewer-request and viewer-response<br> *name:*<br> Name of the function<br> *comment:*<br> Description of the function<br> *code:*<br> Source code of the function<br> *assign:*<br> true for associating the function with the cf distribution,<br> false to remove the association. (to remove the cf function firstly set it<br> to false to dissociate from the cf distribution) | <pre>map(object({<br> name = string<br> comment = string<br> code = string<br> assign = bool<br> }))</pre> | `{}` | no |
| <a name="input_default_root_object"></a> [default\_root\_object](#input\_default\_root\_object) | The object that you want CloudFront to return (for example, index.html) when an end user requests the root URL. | `string` | `null` | no |
| <a name="input_override_s3_origin_policy"></a> [override\_s3\_origin\_policy](#input\_override\_s3\_origin\_policy) | Overrides the S3-bucket policy to set OAI | `bool` | `false` | no |
| <a name="input_s3_logging_hostname"></a> [s3\_logging\_hostname](#input\_s3\_logging\_hostname) | Hostname of S3-bucket to be used for logging | `string` | `""` | no |
| <a name="input_s3_origin_hostname"></a> [s3\_origin\_hostname](#input\_s3\_origin\_hostname) | Hostname of S3-bucket to be used as origin | `string` | `""` | no |
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ module "cloudfront" {
retain_on_delete = false
wait_for_deployment = false

default_root_object = var.default_root_object

create_origin_access_identity = true
origin_access_identities = {
s3_bucket = "Access identity for CDN (${var.r53_hostname})"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ variable "cf_functions" {
error_message = "Only the following event types are allowed: viewer-request, viewer-response."
}
}

variable "default_root_object" {
description = "The object that you want CloudFront to return (for example, index.html) when an end user requests the root URL."
type = string
default = null
}

0 comments on commit 0c844a6

Please sign in to comment.