forked from pierront/but3-iac
plan fonctionnel
This commit is contained in:
@@ -3,43 +3,67 @@ resource "google_compute_network" "vpc" {
|
||||
auto_create_subnetworks = "false"
|
||||
}
|
||||
|
||||
resource "frontend" "subnet" {
|
||||
name = "sub_fr"
|
||||
resource "google_compute_subnetwork" "frontend" {
|
||||
name = "subfr"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.1.0/24"
|
||||
region = "europe-west9"
|
||||
provider = google
|
||||
}
|
||||
|
||||
|
||||
resource "google_compute_subnetwork" "backend" {
|
||||
name = "subba"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.2.0/24"
|
||||
region = "europe-west9"
|
||||
}
|
||||
|
||||
|
||||
resource "google_compute_subnetwork" "database" {
|
||||
name = "subda"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.3.0/24"
|
||||
region = "europe-west9"
|
||||
}
|
||||
|
||||
|
||||
resource "google_compute_firewall" "allow_http_https"{
|
||||
name = "allowhttphttps"
|
||||
network = google_compute_network.vpc.id
|
||||
|
||||
allow {
|
||||
protocol = ssh
|
||||
protocol = "tcp"
|
||||
ports = ["80", "443"]
|
||||
}
|
||||
|
||||
source_ranges = ["0.0.0.0/0"]
|
||||
target_tags = ["frontend"]
|
||||
}
|
||||
|
||||
|
||||
resource "google_compute_firewall" "ssh_f_b"{
|
||||
name = "sshfb"
|
||||
network = google_compute_network.vpc.id
|
||||
|
||||
allow {
|
||||
protocol = "ssh"
|
||||
ports = ["8000"]
|
||||
}
|
||||
|
||||
source_tags = ["frontend"]
|
||||
target_tags = ["backend"]
|
||||
}
|
||||
|
||||
|
||||
resource "backend" "subnet" {
|
||||
name = "sub_ba"
|
||||
resource "google_compute_firewall" "ssh_b_d"{
|
||||
name = "sshbd"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.2.0/24"
|
||||
region = "europe-west9"
|
||||
provider = google
|
||||
|
||||
allow {
|
||||
protocol = ssh
|
||||
protocol = "ssh"
|
||||
ports = ["3306"]
|
||||
}
|
||||
|
||||
source_tags = ["backend"]
|
||||
target_tags = ["database"]
|
||||
|
||||
}
|
||||
|
||||
|
||||
resource "database" "subnet" {
|
||||
name = "sub_da"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.3.0/24"
|
||||
region = "europe-west9"
|
||||
provider = google
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
output "vpc_id" {
|
||||
description = "id du vpc"
|
||||
value = google_compute_network.id
|
||||
value = google_compute_network.vpc.id
|
||||
}
|
||||
|
||||
output "subnets" {
|
||||
description = "ids of subnets"
|
||||
value = {
|
||||
fr_id = frontend.id
|
||||
ba_id = backend.id
|
||||
dat_id = database.id
|
||||
fr_id = google_compute_subnetwork.frontend.id
|
||||
ba_id = google_compute_subnetwork.backend.id
|
||||
dat_id = google_compute_subnetwork.database.id
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user