Skip to content

Commit

Permalink
Use secrets to pass variables to tld redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
theseanything committed Oct 18, 2024
1 parent 56c6f96 commit 7d9f510
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions tld-redirect/service.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
locals {
secrets = yamldecode(var.secrets)
}

resource "fastly_service_vcl" "service" {
name = "${title(var.environment)} TLD Redirect"
comment = ""

domain {
name = var.domain
name = local.secrets["domain"]
}

vcl {
main = true
name = "main"
content = templatefile("${path.module}/tldredirect.vcl.tftpl", { domain = var.domain })
content = templatefile("${path.module}/tldredirect.vcl.tftpl", local.secrets)
}
}
6 changes: 3 additions & 3 deletions tld-redirect/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "environment" {
default = "production"
}

variable "domain" {
type = string
default = "gov.uk"
variable "secrets" {

Check warning on line 6 in tld-redirect/variables.tf

View workflow job for this annotation

GitHub Actions / tflint

`secrets` variable has no type
default = {}
}

0 comments on commit 7d9f510

Please sign in to comment.