Skip to content

Commit 3bab94d

Browse files
authored
Allow for specifying custom bucket names (#9)
* Allow for specifying custom bucket names * Bugfix
1 parent 1bee5a7 commit 3bab94d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ No modules.
3434
| <a name="input_backend_address"></a> [backend\_address](#input\_backend\_address) | Address to use for connecting to the backend. Can be a hostname or an IP address. | `string` | n/a | yes |
3535
| <a name="input_backend_name"></a> [backend\_name](#input\_backend\_name) | Optional name for the backend. | `string` | `""` | no |
3636
| <a name="input_backend_ssl_check"></a> [backend\_ssl\_check](#input\_backend\_ssl\_check) | Be strict about checking SSL certs when connecting to the backend. | `bool` | `true` | no |
37+
| <a name="input_bucket_name"></a> [bucket\_name](#input\_bucket\_name) | Name of the exoscale bucket this service will point to. Default is 'app\_hostname' with dashes instead of periods. | `string` | `""` | no |
3738
| <a name="input_datadog"></a> [datadog](#input\_datadog) | Whether to send logging info to Datadog | `bool` | `false` | no |
3839
| <a name="input_datadog_region"></a> [datadog\_region](#input\_datadog\_region) | The region that log data will be sent to. | `string` | `"EU"` | no |
3940
| <a name="input_datadog_service"></a> [datadog\_service](#input\_datadog\_service) | Datadog service name to use for logs | `string` | `"fastly"` | no |

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ locals {
44
backend_name = var.backend_name != "" ? var.backend_name : "${var.hostname} - backend"
55
ssl_hostname = var.ssl_hostname != "" ? var.ssl_hostname : var.hostname
66

7+
exoscale_bucket = var.bucket_name != "" ? var.bucket_name : replace(var.app_hostname, ".", "-")
78

89
datadog_format = replace(file("${path.module}/logging/datadog.json"), "__service__", var.datadog_service)
9-
vcl_exoscale_forward = templatefile("${path.module}/vcl/exoscale_forward.vcl", { hostname = replace(var.app_hostname, ".", "-") })
10+
vcl_exoscale_forward = templatefile("${path.module}/vcl/exoscale_forward.vcl", { hostname = local.exoscale_bucket })
1011
vcl_recv_various_fixups = file("${path.module}/vcl/recv_misc_fixups.vcl")
1112
vcl_remove_response_headers = file("${path.module}/vcl/remove_response_headers.vcl")
1213
vcl_segmented_caching = file("${path.module}/vcl/segmented_caching.vcl")

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ variable "backend_ssl_check" {
3737
default = true
3838
}
3939

40+
variable "bucket_name" {
41+
description = "Name of the exoscale bucket this service will point to. Default is 'app_hostname' with dashes instead of periods."
42+
type = string
43+
default = ""
44+
}
45+
4046
variable "shield_region" {
4147
description = "Which Fastly shield region to use. Should correspond with the shield code."
4248
type = string

0 commit comments

Comments
 (0)