From 12fc45995bbcbc6b3d2b2ec9124ed9cc7cd9a3f1 Mon Sep 17 00:00:00 2001 From: Darius Date: Fri, 6 Dec 2024 16:31:21 +0100 Subject: [PATCH] fix --- tp-cloud/terraform/environments/dev/main.tf | 2 +- .../terraform/environments/dev/variables.tf | 17 +++++------------ tp-cloud/terraform/modules/compute/main.tf | 6 +++--- tp-cloud/terraform/modules/compute/outputs.tf | 4 ++-- tp-cloud/terraform/modules/compute/variables.tf | 2 +- tp-cloud/terraform/modules/iam/variables.tf | 10 +++++++++- tp-cloud/terraform/modules/network/outputs.tf | 3 ++- tp-cloud/terraform/modules/network/variables.tf | 11 +++++------ 8 files changed, 28 insertions(+), 27 deletions(-) diff --git a/tp-cloud/terraform/environments/dev/main.tf b/tp-cloud/terraform/environments/dev/main.tf index d5841a7..ce0e9b4 100644 --- a/tp-cloud/terraform/environments/dev/main.tf +++ b/tp-cloud/terraform/environments/dev/main.tf @@ -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"] diff --git a/tp-cloud/terraform/environments/dev/variables.tf b/tp-cloud/terraform/environments/dev/variables.tf index 543ae21..4d14250 100644 --- a/tp-cloud/terraform/environments/dev/variables.tf +++ b/tp-cloud/terraform/environments/dev/variables.tf @@ -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" } diff --git a/tp-cloud/terraform/modules/compute/main.tf b/tp-cloud/terraform/modules/compute/main.tf index dd38f46..fa7f979 100644 --- a/tp-cloud/terraform/modules/compute/main.tf +++ b/tp-cloud/terraform/modules/compute/main.tf @@ -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"] diff --git a/tp-cloud/terraform/modules/compute/outputs.tf b/tp-cloud/terraform/modules/compute/outputs.tf index ffd300a..c69a53a 100644 --- a/tp-cloud/terraform/modules/compute/outputs.tf +++ b/tp-cloud/terraform/modules/compute/outputs.tf @@ -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 diff --git a/tp-cloud/terraform/modules/compute/variables.tf b/tp-cloud/terraform/modules/compute/variables.tf index 6840a39..44022ef 100644 --- a/tp-cloud/terraform/modules/compute/variables.tf +++ b/tp-cloud/terraform/modules/compute/variables.tf @@ -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" { diff --git a/tp-cloud/terraform/modules/iam/variables.tf b/tp-cloud/terraform/modules/iam/variables.tf index c76c7b1..89f56ce 100644 --- a/tp-cloud/terraform/modules/iam/variables.tf +++ b/tp-cloud/terraform/modules/iam/variables.tf @@ -2,4 +2,12 @@ variable "project_id" { description = "ID du projet GCP" type = string -} \ No newline at end of file +} + + + + + + + + diff --git a/tp-cloud/terraform/modules/network/outputs.tf b/tp-cloud/terraform/modules/network/outputs.tf index 38df9ba..4dff790 100644 --- a/tp-cloud/terraform/modules/network/outputs.tf +++ b/tp-cloud/terraform/modules/network/outputs.tf @@ -8,4 +8,5 @@ output "id_subnetwork" { backend = google_compute_subnetwork.backend_subnet.id, database = google_compute_subnetwork.database_subnet.id } -} \ No newline at end of file +} + diff --git a/tp-cloud/terraform/modules/network/variables.tf b/tp-cloud/terraform/modules/network/variables.tf index e56ec80..f644522 100644 --- a/tp-cloud/terraform/modules/network/variables.tf +++ b/tp-cloud/terraform/modules/network/variables.tf @@ -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