This commit is contained in:
Yanis DARIUS 2024-12-04 16:35:38 +01:00
parent 5bc65ab504
commit ff4eeddf57

View File

@ -24,7 +24,7 @@ resource "google_compute_subnetwork" "db" {
region = var.region region = var.region
} }
resource "google_compute_firewall" "allowhttphttps" { resource "google_compute_firewall" "allow_http-https" {
name = "allow-http-https" name = "allow-http-https"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
@ -37,7 +37,7 @@ resource "google_compute_firewall" "allowhttphttps" {
target_tags = ["web"] target_tags = ["web"]
} }
resource "google_compute_firewall" "allowssh" { resource "google_compute_firewall" "allow_ssh" {
name = "allow-ssh" name = "allow-ssh"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
@ -46,12 +46,12 @@ resource "google_compute_firewall" "allowssh" {
ports = ["22"] ports = ["22"]
} }
source_ranges = var.ssh_source_ranges source_ranges = [var.ssh_source_ranges]
target_tags = ["web"] target_tags = ["web"]
} }
resource "google_compute_firewall" "fronttoback" { resource "google_compute_firewall" "front-to-back" {
name = "front-to-back" name = "front-to-back"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
@ -60,19 +60,19 @@ resource "google_compute_firewall" "fronttoback" {
ports = ["8000"] ports = ["8000"]
} }
source_ranges = var.frontend_cidr source_ranges = [var.frontend_cidr]
target_tags = ["backend"] target_tags = ["backend"]
} }
resource "google_compute_firewall" "backtodb" { resource "google_compute_firewall" "back-to-db" {
name = "back-to-db" name = "front-to-back"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
allow { allow {
protocol = "tcp" protocol = "tcp"
ports = ["3306"] ports = ["8000"]
} }
source_ranges = var.backend_cidr source_ranges = [var.backend_cidr]
target_tags = ["database"] target_tags = ["database"]
} }