TP7virtu/tp-cloud/terraform/modules/compute/main.tf

69 lines
1.2 KiB
Terraform
Raw Normal View History

2024-12-06 14:42:39 +01:00
resource "google_compute_instance" "frontend" {
2024-12-06 14:54:26 +01:00
name = "ma-vm-frontend"
2024-12-06 14:42:39 +01:00
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
}
tags = ["frontend", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
resource "google_compute_instance" "backend" {
2024-12-06 14:54:26 +01:00
name = "ma-vm-backend"
2024-12-06 14:42:39 +01:00
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" {
2024-12-06 14:54:26 +01:00
name = "ma-vm-database"
2024-12-06 14:42:39 +01:00
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
}
tags = ["database", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}