This commit is contained in:
2025-12-03 17:29:15 +01:00
parent 1f344183f8
commit b18e0ec5a2
2 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
resource "google_compute_instance" "frontend" {
name = "frontend-instance"
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 {}
}
tags= ["frontend", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
resource "google_compute_instance" "backend" {
name = "backend-instance"
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
}
tags = ["backend", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
resource "google_compute_instance" "database" {
name = "database-instance"
machine_type = var.instance_type
zone = var.zone
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
size = 10
}
}
network_interface {
subnetwork = var.database_subnet_id
}
tags = ["database", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}

View File

@@ -0,0 +1,27 @@
variable "instance_type" {
description = "Type de machine à utiliser pour les instances"
type = string
}
variable "zone" {
description = "Zone où déployer les instances"
type = string
}
variable "frontend_subnet_id" {
description = "ID du sous-réseau frontend"
type = string
}
variable "backend_subnet_id" {
description = "ID du sous-réseau backend"
type = string
}
variable "database_subnet_id" {
description = "ID du sous-réseau database"
type = string
}