Correction regle firewall

This commit is contained in:
Tom MOGULJAK 2024-12-04 16:48:45 +01:00
parent 19a8716045
commit b5dfcfcba4

View File

@ -30,7 +30,7 @@ resource "google_compute_subnetwork" "database" {
# Règle de pare-feu # Règle de pare-feu
resource "google_compute_firewall" "allow_ssh" { resource "google_compute_firewall" "allow_ssh" {
name = "allow-ssh" name = "allow-ssh-22"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
allow { allow {
@ -48,27 +48,27 @@ resource "google_compute_firewall" "allow_http" {
allow { allow {
protocol = "tcp" protocol = "tcp"
ports = ["80, 443"] ports = ["80", "443"]
} }
source_ranges = ["0.0.0.0/0"] source_ranges = ["0.0.0.0/0"]
target_tags = ["web"] target_tags = ["frontend"]
} }
resource "google_compute_firewall" "allow_front-to-back" { resource "google_compute_firewall" "allow_frontend_backend" {
name = "allow-front-to-back" name = "allow-front-to-back"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
allow { allow {
protocol = "tcp" protocol = "tcp"
ports = ["8080"] ports = ["8000"]
} }
source_ranges = ["frontend"] source_tags = ["frontend"]
target_tags = ["backend"] target_tags = ["backend"]
} }
resource "google_compute_firewall" "allow_back-to-db" { resource "google_compute_firewall" "allow_backend_db" {
name = "allow-back-to-db" name = "allow-back-to-db"
network = google_compute_network.vpc.id network = google_compute_network.vpc.id
@ -77,6 +77,6 @@ resource "google_compute_firewall" "allow_back-to-db" {
ports = ["3306"] ports = ["3306"]
} }
source_ranges = ["backend"] source_tags = ["backend"]
target_tags = ["database"] target_tags = ["database"]
} }