t
This commit is contained in:
73
terraform/modules/compute/main.tf
Normal file
73
terraform/modules/compute/main.tf
Normal file
@@ -0,0 +1,73 @@
|
||||
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 {
|
||||
subnetwork = var.sub1
|
||||
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 {
|
||||
subnetwork = var.sub2
|
||||
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 {
|
||||
subnetwork = var.sub3
|
||||
access_config {} # IP publique
|
||||
}
|
||||
|
||||
tags = ["database", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
||||
|
||||
|
0
terraform/modules/compute/outputs.tf
Normal file
0
terraform/modules/compute/outputs.tf
Normal file
47
terraform/modules/compute/variables.tf
Normal file
47
terraform/modules/compute/variables.tf
Normal file
@@ -0,0 +1,47 @@
|
||||
variable "instance_type" {
|
||||
description = "type d'instance"
|
||||
type = string
|
||||
default = "e2-micro"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
description = "zone"
|
||||
type = string
|
||||
default = "europe-west4-a"
|
||||
}
|
||||
|
||||
variable "frontend_cidr" {
|
||||
description = "range_front"
|
||||
type = string
|
||||
default = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
variable "backend_cidr" {
|
||||
description = "range_back"
|
||||
type = string
|
||||
default = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
variable "database_cidr" {
|
||||
description = "range_database"
|
||||
type = string
|
||||
default = "10.0.3.0/24"
|
||||
}
|
||||
|
||||
variable "sub1" {
|
||||
description = "subnet front"
|
||||
type = string
|
||||
}
|
||||
|
||||
|
||||
variable "sub2" {
|
||||
description = "subnet back"
|
||||
type = string
|
||||
}
|
||||
|
||||
|
||||
variable "sub3" {
|
||||
description = "subnet database"
|
||||
type = string
|
||||
}
|
||||
|
Reference in New Issue
Block a user