forked from pierront/but3-iac
encore xje sais plus
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
|
||||
# Instance front-end
|
||||
|
||||
resource "google_compute_instance" "frontend_vm" {
|
||||
name = "frontend-vm"
|
||||
machine_type = "e2-medium"
|
||||
zone = "europe-west1-b"
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
access_config {} # IP publique
|
||||
subnetwork = google_compute_subnetwork.subnet_frontend.id
|
||||
}
|
||||
|
||||
tags = ["frontend", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
||||
|
||||
# Instance back-end
|
||||
|
||||
resource "google_compute_instance" "backend_vm" {
|
||||
name = "backend-vm"
|
||||
machine_type = "e2-medium"
|
||||
zone = "europe-west1-b"
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
|
||||
subnetwork = google_compute_subnetwork.subnet_backend.id
|
||||
}
|
||||
|
||||
tags = ["backend", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Instance data-base
|
||||
|
||||
resource "google_compute_instance" "database_vm" {
|
||||
name = "database-vm"
|
||||
machine_type = "e2-medium"
|
||||
zone = "europe-west1-b"
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 20
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
|
||||
subnetwork = google_compute_subnetwork.subnet_database.id
|
||||
}
|
||||
|
||||
tags = ["database", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,21 +7,26 @@
|
||||
|
||||
|
||||
variable "instance_type" {
|
||||
description = "type de l'instance"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
description = "région"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "frontend_subnet_id" {
|
||||
type = number
|
||||
description = "front-end id"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "backend_subnet_id" {
|
||||
type = number
|
||||
description = "back-end id"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "database_subnet_id" {
|
||||
type = number
|
||||
description = "database id"
|
||||
type = string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user