forked from pierront/but3-iac
pb providers
This commit is contained in:
0
terraform/modules/compute/main.tf
Normal file
0
terraform/modules/compute/main.tf
Normal file
0
terraform/modules/compute/outputs.tf
Normal file
0
terraform/modules/compute/outputs.tf
Normal file
0
terraform/modules/compute/variables.tf
Normal file
0
terraform/modules/compute/variables.tf
Normal file
0
terraform/modules/iam/main.tf
Normal file
0
terraform/modules/iam/main.tf
Normal file
0
terraform/modules/iam/outputs.tf
Normal file
0
terraform/modules/iam/outputs.tf
Normal file
0
terraform/modules/iam/variables.tf
Normal file
0
terraform/modules/iam/variables.tf
Normal file
42
terraform/modules/network/main.tf
Normal file
42
terraform/modules/network/main.tf
Normal file
@@ -0,0 +1,42 @@
|
||||
resource "google_compute_network" "vpc" {
|
||||
name = "vpc-1"
|
||||
auto_create_subnetworks = "false"
|
||||
}
|
||||
|
||||
resource "frontend" "subnet" {
|
||||
name = "sub_fr"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.200.6.3/24"
|
||||
region = "europe-west9"
|
||||
|
||||
allow {
|
||||
protocol = ssh
|
||||
ports = ["8000"]
|
||||
}
|
||||
|
||||
target_tags = ["backend"]
|
||||
}
|
||||
|
||||
|
||||
resource "backend" "subnet" {
|
||||
name = "sub_ba"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.200.7.3/24"
|
||||
region = "europe-west9"
|
||||
|
||||
allow {
|
||||
protocol = ssh
|
||||
ports = ["3306"]
|
||||
}
|
||||
|
||||
target_tags = ["database"]
|
||||
|
||||
}
|
||||
|
||||
|
||||
resource "database" "subnet" {
|
||||
name = "sub_da"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.200.8.3/24"
|
||||
region = "europe-west9"
|
||||
}
|
||||
13
terraform/modules/network/outputs.tf
Normal file
13
terraform/modules/network/outputs.tf
Normal file
@@ -0,0 +1,13 @@
|
||||
output "vpc_id" {
|
||||
description = "id du vpc"
|
||||
value = google_compute_network.id
|
||||
}
|
||||
|
||||
output "subnets" {
|
||||
description = "ids of subnets"
|
||||
value = {
|
||||
fr_id = frontend.id
|
||||
ba_id = backend.id
|
||||
dat_id = database.id
|
||||
}
|
||||
}
|
||||
24
terraform/modules/network/variables.tf
Normal file
24
terraform/modules/network/variables.tf
Normal file
@@ -0,0 +1,24 @@
|
||||
variable "frontend_cidr" {
|
||||
description = "CIDR for frontend subnet"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "backend_cidr" {
|
||||
description = "CIDR for backend subnet"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "database_cidr" {
|
||||
description = "CIDR for database subnet"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "project_name"{
|
||||
description = "name of the project"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region"{
|
||||
description = "region of the project"
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user