test network
This commit is contained in:
parent
1e35f83f58
commit
042bfd5c24
@ -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" "allow-http-https" {
|
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
|
||||||
|
|
||||||
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" "allow-ssh" {
|
resource "google_compute_firewall" "allow-ssh" {
|
||||||
name = "allow-ssh"
|
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" "front-to-back" {
|
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
|
||||||
|
|
||||||
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" "back-to-db" {
|
resource "google_compute_firewall" "back_to_db" {
|
||||||
name = "back-to-db"
|
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