This commit is contained in:
Yanis DARIUS 2024-12-06 16:31:21 +01:00
parent 9262123ee7
commit 12fc45995b
8 changed files with 28 additions and 27 deletions

View File

@ -31,7 +31,7 @@ module "compute" {
source = "../../modules/compute"
instance_type = "e2-micro"
zone ="europe-west4-a"
zone ="europe-west9-c"
frontend_subnet_id = module.network.id_subnetwork["frontend"]
backend_subnet_id = module.network.id_subnetwork["backend"]
database_subnet_id = module.network.id_subnetwork["database"]

View File

@ -1,48 +1,41 @@
#- project_name (string)
variable "project_name" {
description = "Nom du projet"
type = string
default = "newtp-443913"
}
#- project_id (string)
variable "project_id" {
description = "ID du projet"
description = "projet id"
type = string
default = "newtp-443913"
}
# - region (string)
variable "region" {
description = "Région du projet"
description = "Region"
type = string
default = "europe-west4"
default = "europe-west9"
}
# - frontend_cidr (string)
variable "frontend_cidr" {
description = "cidr du frontend"
type = string
default = "10.0.1.0/24"
}
# - backend_cidr (string)
variable "backend_cidr" {
description = "cidr du backend"
type = string
default = "10.0.2.0/24"
}
# - database_cidr (string)
variable "database_cidr" {
description = "cidr du database"
description = "cidr du db"
type = string
default = "10.0.3.0/24"
}
# - ssh_source_ranges (string)
variable "ssh_source_ranges" {
description = "Accès à internet"
description = "ssh"
type = string
default = "0.0.0.0/0"
}

View File

@ -12,7 +12,7 @@ resource "google_compute_instance" "frontend" {
network_interface {
subnetwork = var.frontend_subnet_id
access_config {} # IP publique
access_config {}
}
tags = ["frontend", "ssh"]
@ -36,7 +36,7 @@ resource "google_compute_instance" "backend" {
network_interface {
subnetwork = var.backend_subnet_id
access_config {} # IP publique
access_config {}
}
tags = ["backend", "ssh"]
@ -60,7 +60,7 @@ resource "google_compute_instance" "database" {
network_interface {
subnetwork = var.database_subnet_id
access_config {} # IP publique
access_config {}
}
tags = ["database", "ssh"]

View File

@ -1,5 +1,5 @@
output "instance_names" {
description = "Noms des instances"
description = "Nom instance"
value = {
frontend = google_compute_instance.frontend.name
backend = google_compute_instance.backend.name
@ -12,7 +12,7 @@ output "frontend_public_ip" {
}
output "private_ip" {
description = "IPs internes de toutes les instances"
description = "IP internes"
value = {
frontend = google_compute_instance.frontend.network_interface[0].network_ip
backend = google_compute_instance.backend.network_interface[0].network_ip

View File

@ -7,7 +7,7 @@ variable "instance_type" {
variable "zone" {
description = "zone des instances"
type = string
default = "europe-west4"
default = "europe-west9"
}
variable "frontend_subnet_id" {

View File

@ -3,3 +3,11 @@ variable "project_id" {
description = "ID du projet GCP"
type = string
}

View File

@ -9,3 +9,4 @@ output "id_subnetwork" {
database = google_compute_subnetwork.database_subnet.id
}
}

View File

@ -1,29 +1,28 @@
#- project_name (string)
variable "project_name" {
description = "Nom du projet"
type = string
}
# - region (string)
variable "region" {
description = "Région du projet"
type = string
}
# - frontend_cidr (string)
variable "frontend_cidr" {
description = "cidr du frontend"
type = string
}
# - backend_cidr (string)
variable "backend_cidr" {
description = "cidr du backend"
type = string
}
# - database_cidr (string)
variable "database_cidr" {
description = "cidr du database"
type = string
}
# - ssh_source_ranges (string)
variable "ssh_source_ranges" {
description = "Accès à internet"
type = string