From 042bfd5c24296ea98fd00e57db435f35a15a77a5 Mon Sep 17 00:00:00 2001 From: SimonSayeBabu Date: Wed, 4 Dec 2024 16:35:15 +0100 Subject: [PATCH] test network --- terraform/modules/network/main.tf | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/terraform/modules/network/main.tf b/terraform/modules/network/main.tf index 7125b72..3688c6f 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" "allow-http-https" { +resource "google_compute_firewall" "allow-http-https" { name = "allow-http-https" - network = google-compute-network.vpc.id + 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" "allow-ssh" { +resource "google_compute_firewall" "allow-ssh" { name = "allow-ssh" - network = google-compute-network.vpc.id + 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" "front-to-back" { - name = "front-to-back" - 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" "back-to-db" { - name = "back-to-db" - 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