forked from pierront/but3-iac
on espere ca va marcher
This commit is contained in:
71
terraform/modules/compute/main.tf
Normal file
71
terraform/modules/compute/main.tf
Normal file
@@ -0,0 +1,71 @@
|
||||
resource "google_compute_instance" "frontend" {
|
||||
name = "frontend"
|
||||
machine_type = var.instance_type
|
||||
zone = var.zone
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = var.frontend_subnet_id
|
||||
access_config {} # IP publique
|
||||
}
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
|
||||
tags = ["frontend", "ssh"]
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "backend" {
|
||||
name = "backend"
|
||||
machine_type = var.instance_type
|
||||
zone = var.zone
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = var.backend_subnet_id
|
||||
# Pas d'IP publique
|
||||
}
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
|
||||
tags = ["backend", "ssh"]
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "database" {
|
||||
name = "database"
|
||||
machine_type = var.instance_type
|
||||
zone = var.zone
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 20
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = var.database_subnet_id
|
||||
# Pas d'IP publique
|
||||
}
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
|
||||
tags = ["database", "ssh"]
|
||||
}
|
||||
Reference in New Issue
Block a user