From 1e35f83f5832ab7d05b3429b4da20b4cb82a75c7 Mon Sep 17 00:00:00 2001 From: SimonSayeBabu Date: Wed, 4 Dec 2024 16:32:43 +0100 Subject: [PATCH] test network --- terraform/modules/network/main.tf | 62 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/terraform/modules/network/main.tf b/terraform/modules/network/main.tf index 435e3ef..7125b72 100644 --- a/terraform/modules/network/main.tf +++ b/terraform/modules/network/main.tf @@ -1,77 +1,77 @@ -resource "google_compute_network" "vpc" { +resource "google-compute-network" "vpc" { name = "vpcsim" - auto_create_subnetworks = false + auto-create-subnetworks = false } -resource "google_compute_subnetwork" "frontend" { +resource "google-compute-subnetwork" "frontend" { name = "frontend" - network = google_compute_network.vpc.id - ip_cidr_range = var.frontend_cidr + network = google-compute-network.vpc.id + ip-cidr-range = var.frontend-cidr region = var.region } -resource "google_compute_subnetwork" "backend" { +resource "google-compute-subnetwork" "backend" { name = "backend" - network = google_compute_network.vpc.id - ip_cidr_range = var.backend_cidr + network = google-compute-network.vpc.id + ip-cidr-range = var.backend-cidr region = var.region } -resource "google_compute_subnetwork" "database" { +resource "google-compute-subnetwork" "database" { name = "database" - network = google_compute_network.vpc.id - ip_cidr_range = var.database_cidr + network = google-compute-network.vpc.id + ip-cidr-range = var.database-cidr region = var.region } -resource "google_compute_firewall" "allowHttpHttps" { - name = "allowHttpHttps" - network = google_compute_network.vpc.id +resource "google-compute-firewall" "allow-http-https" { + name = "allow-http-https" + network = google-compute-network.vpc.id allow { protocol = "tcp" ports = ["80", "443"] } - source_ranges = ["0.0.0.0/0"] - target_tags = ["web"] + source-ranges = ["0.0.0.0/0"] + target-tags = ["web"] } -resource "google_compute_firewall" "allowSsh" { - name = "allowSsh" - network = google_compute_network.vpc.id +resource "google-compute-firewall" "allow-ssh" { + name = "allow-ssh" + network = google-compute-network.vpc.id allow { protocol = "tcp" ports = ["22"] } - source_ranges = var.ssh_source_ranges - target_tags = ["ssh"] + source-ranges = var.ssh-source-ranges + target-tags = ["ssh"] } -resource "google_compute_firewall" "frontToBack" { - name = "frontToBack" - network = google_compute_network.vpc.id +resource "google-compute-firewall" "front-to-back" { + name = "front-to-back" + network = google-compute-network.vpc.id allow { protocol = "tcp" ports = ["8000"] } - source_ranges = var.frontend_cidr - target_tags = ["backend"] + source-ranges = var.frontend-cidr + target-tags = ["backend"] } -resource "google_compute_firewall" "backToDb" { - name = "backToDb" - network = google_compute_network.vpc.id +resource "google-compute-firewall" "back-to-db" { + name = "back-to-db" + network = google-compute-network.vpc.id allow { protocol = "tcp" ports = ["3306"] } - source_ranges = var.backend_cidr - target_tags = ["database"] + source-ranges = var.backend-cidr + target-tags = ["database"] } \ No newline at end of file