test network
This commit is contained in:
parent
2d36ce6482
commit
1e35f83f58
@ -1,77 +1,77 @@
|
|||||||
resource "google_compute_network" "vpc" {
|
resource "google-compute-network" "vpc" {
|
||||||
name = "vpcsim"
|
name = "vpcsim"
|
||||||
auto_create_subnetworks = false
|
auto-create-subnetworks = false
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_subnetwork" "frontend" {
|
resource "google-compute-subnetwork" "frontend" {
|
||||||
name = "frontend"
|
name = "frontend"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
ip_cidr_range = var.frontend_cidr
|
ip-cidr-range = var.frontend-cidr
|
||||||
region = var.region
|
region = var.region
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_subnetwork" "backend" {
|
resource "google-compute-subnetwork" "backend" {
|
||||||
name = "backend"
|
name = "backend"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
ip_cidr_range = var.backend_cidr
|
ip-cidr-range = var.backend-cidr
|
||||||
region = var.region
|
region = var.region
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_subnetwork" "database" {
|
resource "google-compute-subnetwork" "database" {
|
||||||
name = "database"
|
name = "database"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
ip_cidr_range = var.database_cidr
|
ip-cidr-range = var.database-cidr
|
||||||
region = var.region
|
region = var.region
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_firewall" "allowHttpHttps" {
|
resource "google-compute-firewall" "allow-http-https" {
|
||||||
name = "allowHttpHttps"
|
name = "allow-http-https"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
|
|
||||||
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 = ["web"]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_firewall" "allowSsh" {
|
resource "google-compute-firewall" "allow-ssh" {
|
||||||
name = "allowSsh"
|
name = "allow-ssh"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
ports = ["22"]
|
ports = ["22"]
|
||||||
}
|
}
|
||||||
|
|
||||||
source_ranges = var.ssh_source_ranges
|
source-ranges = var.ssh-source-ranges
|
||||||
target_tags = ["ssh"]
|
target-tags = ["ssh"]
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_compute_firewall" "frontToBack" {
|
resource "google-compute-firewall" "front-to-back" {
|
||||||
name = "frontToBack"
|
name = "front-to-back"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
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 = "backToDb"
|
name = "back-to-db"
|
||||||
network = google_compute_network.vpc.id
|
network = google-compute-network.vpc.id
|
||||||
|
|
||||||
allow {
|
allow {
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
ports = ["3306"]
|
ports = ["3306"]
|
||||||
}
|
}
|
||||||
|
|
||||||
source_ranges = var.backend_cidr
|
source-ranges = var.backend-cidr
|
||||||
target_tags = ["database"]
|
target-tags = ["database"]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user