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"
|
||||
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"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user