diff --git a/infra/cloudflare/01-amrik.co.uk.tf b/infra/cloudflare/01-amrik.co.uk.tf index bf1b1a6..23494e9 100644 --- a/infra/cloudflare/01-amrik.co.uk.tf +++ b/infra/cloudflare/01-amrik.co.uk.tf @@ -41,7 +41,7 @@ resource "cloudflare_record" "amrik_co_uk" { zone_id = data.sops_file.cloudflare-secret.data["cloudflare.amrik.co.uk.zone_id"] name = "@" type = "CNAME" - content = "amrik-co-uk.pages.dev" + content = "amrik-co-uk.pages.dev" } //Kate @@ -61,5 +61,5 @@ resource "cloudflare_record" "kate_amrik_co_uk" { zone_id = data.sops_file.cloudflare-secret.data["cloudflare.amrik.co.uk.zone_id"] name = "kate" type = "CNAME" - content = "kate-amrik-co-uk.pages.dev" + content = "kate-amrik-co-uk.pages.dev" } diff --git a/infra/cloudflare/03-amrik.xyz.tf b/infra/cloudflare/03-amrik.xyz.tf index 363f41e..3336a96 100644 --- a/infra/cloudflare/03-amrik.xyz.tf +++ b/infra/cloudflare/03-amrik.xyz.tf @@ -7,5 +7,5 @@ resource "cloudflare_record" "amrik_xyz" { zone_id = data.sops_file.cloudflare-secret.data["cloudflare.amrik.xyz.zone_id"] name = "@" type = "A" - content = var.ip_address + content = var.ip_address } diff --git a/infra/gcp/00-providers.tf b/infra/gcp/00-providers.tf index 13876b4..0745227 100644 --- a/infra/gcp/00-providers.tf +++ b/infra/gcp/00-providers.tf @@ -1,15 +1,15 @@ terraform { - required_version = ">= 1.5.7" - required_providers { - google = { - source = "hashicorp/google" - version = "6.13.0" - } - sops = { - source = "carlpett/sops" - version = "~> 1.0.0" - } + required_version = ">= 1.5.7" + required_providers { + google = { + source = "hashicorp/google" + version = "6.13.0" } + sops = { + source = "carlpett/sops" + version = "~> 1.0.0" + } + } } data "sops_file" "gcp-secret" { @@ -17,7 +17,7 @@ data "sops_file" "gcp-secret" { } provider "google" { - project = "milestone-medical" - credentials = data.sops_file.gcp-secret.data["google.credentials"] - zone = "us-central1-a" + project = "milestone-medical" + credentials = data.sops_file.gcp-secret.data["google.credentials"] + zone = "us-central1-a" } diff --git a/infra/gcp/01-project.tf b/infra/gcp/01-project.tf index 1d94c46..b6a1687 100644 --- a/infra/gcp/01-project.tf +++ b/infra/gcp/01-project.tf @@ -20,7 +20,7 @@ resource "google_compute_instance" "frappe" { } metadata = { - ssh-keys = format("%s:%s", data.sops_file.gcp-secret.data["google.ssh.user"], data.sops_file.gcp-secret.data["google.ssh.public_key"]) + ssh-keys = format("%s:%s", data.sops_file.gcp-secret.data["google.ssh.user"], data.sops_file.gcp-secret.data["google.ssh.public_key"]) startup-script = <<-EOT #!/bin/bash apt-get update @@ -53,100 +53,100 @@ resource "google_compute_instance" "frappe" { } } - provisioner "file" { - source = "${path.module}/frappe/docker.service" - destination = "docker.service" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + provisioner "file" { + source = "${path.module}/frappe/docker.service" + destination = "docker.service" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" } + } - provisioner "file" { - source = "${path.module}/frappe/nginx-certs.conf" - destination = "nginx-certs.conf" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + provisioner "file" { + source = "${path.module}/frappe/nginx-certs.conf" + destination = "nginx-certs.conf" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" } - provisioner "file" { - source = "${path.module}/frappe/nginx-front.conf" - destination = "nginx-front.conf" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + } + provisioner "file" { + source = "${path.module}/frappe/nginx-front.conf" + destination = "nginx-front.conf" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" } + } - provisioner "file" { - source = "${path.module}/frappe/docker-compose.app.service" - destination = "docker-compose.app.service" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + provisioner "file" { + source = "${path.module}/frappe/docker-compose.app.service" + destination = "docker-compose.app.service" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" } + } provisioner "file" { - source = "${path.module}/frappe/docker-compose.yaml" - destination = "docker-compose.yaml" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + source = "${path.module}/frappe/docker-compose.yaml" + destination = "docker-compose.yaml" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" + } } provisioner "file" { - source = "${path.module}/frappe/renew.timer" - destination = "renew.timer" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + source = "${path.module}/frappe/renew.timer" + destination = "renew.timer" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" + } } provisioner "file" { - source = "${path.module}/frappe/renew.service" - destination = "renew.service" - connection { - type = "ssh" - host = self.network_interface[0].access_config[0].nat_ip - user = data.sops_file.gcp-secret.data["google.ssh.user"] - private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] - timeout = "4m" - } + source = "${path.module}/frappe/renew.service" + destination = "renew.service" + connection { + type = "ssh" + host = self.network_interface[0].access_config[0].nat_ip + user = data.sops_file.gcp-secret.data["google.ssh.user"] + private_key = data.sops_file.gcp-secret.data["google.ssh.private_key"] + timeout = "4m" + } } } resource "google_compute_firewall" "default-ssh" { - name = "allow-ssh" - network = "default" - allow { - protocol = "tcp" - ports = ["22"] - } - source_ranges = [ - "213.78.238.32/32" - ] + name = "allow-ssh" + network = "default" + allow { + protocol = "tcp" + ports = ["22"] + } + source_ranges = [ + "213.78.238.32/32" + ] } output "frappe_ip_address" { diff --git a/infra/main.tf b/infra/main.tf index 7a2fa1e..71bdb90 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -7,12 +7,12 @@ terraform { } } module "cloudflare" { - source = "./cloudflare/" + source = "./cloudflare/" ip_address = module.gcp.frappe_ip_address } module "gcp" { - source = "./gcp/" + source = "./gcp/" } module "unifi" {