virtualisation/modules/compute/main.tf

74 lines
1.3 KiB
Terraform
Raw Normal View History

2024-12-04 17:02:32 +01:00
resource "google_compute_instance" "vm-front" {
name = "vm-front"
machine_type = var.instance_type
zone = var.zone
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
size = 10
}
}
2024-12-06 14:20:50 +01:00
network_interface {
subnetwork = google_compute_network.subnet1.id
access_config {} # IP publique
}
2024-12-04 17:02:32 +01:00
2024-12-06 14:20:50 +01:00
tags = ["web", "ssh"]
2024-12-04 17:02:32 +01:00
2024-12-06 14:20:50 +01:00
metadata = {
enable-oslogin = "TRUE"
}
2024-12-04 17:02:32 +01:00
}
2024-12-06 14:16:05 +01:00
2024-12-04 17:02:32 +01:00
resource "google_compute_instance" "vm-back" {
name = "vm-back"
machine_type = var.instance_type
zone = var.zone
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
size = 10
}
}
network_interface {
2024-12-06 14:13:13 +01:00
subnetwork = google_compute_network.subnet2.id
2024-12-04 17:02:32 +01:00
access_config {} # IP publique
}
tags = ["backend", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
resource "google_compute_instance" "vm-database" {
name = "vm"-database
machine_type = var.instance_type
zone = var.zone
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
size = 20
}
}
network_interface {
2024-12-06 14:13:13 +01:00
subnetwork = google_compute_network.subnet3.id
2024-12-04 17:02:32 +01:00
access_config {} # IP publique
}
tags = ["database", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
2024-12-06 14:20:50 +01:00