TP_Terraform/modules/compute/main.tf

74 lines
1.2 KiB
Terraform
Raw Normal View History

2024-12-06 14:44:53 +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
}
}
network_interface {
2024-12-06 15:51:04 +01:00
subnetwork = var.sub1
2024-12-06 14:44:53 +01:00
access_config {} # IP publique
}
tags = ["web", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
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 15:51:04 +01:00
subnetwork = var.sub2
2024-12-06 14:44:53 +01:00
access_config {} # IP publique
}
tags = ["backend", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}
resource "google_compute_instance" "vm-database" {
2024-12-06 15:34:58 +01:00
name = "vm-database"
2024-12-06 14:44:53 +01:00
machine_type = var.instance_type
zone = var.zone
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
size = 20
}
}
network_interface {
2024-12-06 15:51:04 +01:00
subnetwork = var.sub3
2024-12-06 14:44:53 +01:00
access_config {} # IP publique
}
tags = ["database", "ssh"]
metadata = {
enable-oslogin = "TRUE"
}
}