Skip to content

Commit

Permalink
Make mobile-backend a standalone TF module
Browse files Browse the repository at this point in the history
  • Loading branch information
samsimpson1 committed Sep 5, 2024
1 parent 9e029f4 commit f7b2c00
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 24 deletions.
24 changes: 24 additions & 0 deletions mobile-backend/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions mobile-backend/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
cloud {
organization = "govuk"
workspaces {
tags = ["fastly", "mobile-backend"]
}
}
required_version = "~> 1.7"
required_providers {
fastly = {
source = "fastly/fastly"
version = "5.11.0"
}
}
}

provider "fastly" {}
File renamed without changes.
12 changes: 8 additions & 4 deletions modules/mobile-backend/main.tf → mobile-backend/service.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
locals {
secrets = yamldecode(var.secrets)
hostname = local.secrets["hostname"]
origin_hostname = local.secrets["origin_hostname"]

strip_headers = [
"x-amz-id-2",
"x-amz-meta-server-side-encryption",
Expand All @@ -17,12 +21,12 @@ resource "fastly_service_vcl" "mobile_backend_service" {
http3 = true

domain {
name = var.hostname
name = local.hostname
}

backend {
name = "Mobile backend config bucket - ${var.environment}"
address = var.origin_hostname
address = local.origin_hostname
port = 443

connect_timeout = 1000
Expand All @@ -32,8 +36,8 @@ resource "fastly_service_vcl" "mobile_backend_service" {

ssl_check_cert = true
ssl_ciphers = "ECDHE-RSA-AES256-GCM-SHA384"
ssl_cert_hostname = var.origin_hostname
ssl_sni_hostname = var.origin_hostname
ssl_cert_hostname = local.origin_hostname
ssl_sni_hostname = local.origin_hostname
min_tls_version = "1.2"
}

Expand Down
7 changes: 7 additions & 0 deletions mobile-backend/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
variable "environment" {
type = string
}

variable "secrets" {
type = string
}
9 changes: 0 additions & 9 deletions modules/mobile-backend/provider.tf

This file was deleted.

11 changes: 0 additions & 11 deletions modules/mobile-backend/variables.tf

This file was deleted.

0 comments on commit f7b2c00

Please sign in to comment.