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