Skip to content

Commit

Permalink
terraform format
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrikSD committed Dec 17, 2024
1 parent 74d168d commit 17d4f52
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions infra/cloudflare/01-amrik.co.uk.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
2 changes: 1 addition & 1 deletion infra/cloudflare/03-amrik.xyz.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
26 changes: 13 additions & 13 deletions infra/gcp/00-providers.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
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" {
source_file = "${path.module}/gcp.sops.yaml"
}

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"
}
154 changes: 77 additions & 77 deletions infra/gcp/01-project.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 17d4f52

Please sign in to comment.