forked from pierront/but3-iac
presque fini (je pense)
This commit is contained in:
@@ -53,7 +53,7 @@ resource "google_compute_instance" "database" {
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
size = 20
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
variable "project_name" {
|
||||
type = string
|
||||
description = "Nom du projet / préfixe pour les VMs"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "instance_type" {
|
||||
type = string
|
||||
description = "Type de machine à utiliser pour les instances"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
description = "Zone où déployer les instances"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "frontend_subnet_id" {
|
||||
type = string
|
||||
description = "ID du sous-réseau frontend"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "backend_subnet_id" {
|
||||
type = string
|
||||
description = "ID du sous-réseau backend"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "database_subnet_id" {
|
||||
type = string
|
||||
description = "ID du sous-réseau database"
|
||||
type = string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
variable "project_id" {
|
||||
type = string
|
||||
description = "ID du projet GCP"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "ssh_public_key_path" {
|
||||
type = string
|
||||
description = "Chemin vers la clé publique SSH"
|
||||
type = string
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ resource "google_compute_subnetwork" "database_network" {
|
||||
}
|
||||
|
||||
resource "google_compute_firewall" "ssh_firewall" {
|
||||
name = "${var.project_name}-ssh"
|
||||
network = google_compute_network.vpc.name
|
||||
direction = "INGRESS"
|
||||
priority = 1000
|
||||
target_tags = ["ssh"]
|
||||
name = "${var.project_name}-ssh"
|
||||
network = google_compute_network.vpc.name
|
||||
direction = "INGRESS"
|
||||
priority = 1000
|
||||
target_tags = ["ssh"]
|
||||
source_ranges = [var.ssh_source_ranges]
|
||||
|
||||
allow {
|
||||
@@ -39,11 +39,11 @@ resource "google_compute_firewall" "ssh_firewall" {
|
||||
}
|
||||
|
||||
resource "google_compute_firewall" "frontend_firewall" {
|
||||
name = "${var.project_name}-frontend-http-https"
|
||||
network = google_compute_network.vpc.name
|
||||
direction = "INGRESS"
|
||||
priority = 1000
|
||||
target_tags = ["frontend"]
|
||||
name = "${var.project_name}-frontend-http-https"
|
||||
network = google_compute_network.vpc.name
|
||||
direction = "INGRESS"
|
||||
priority = 1000
|
||||
target_tags = ["frontend"]
|
||||
source_ranges = ["0.0.0.0/0"]
|
||||
|
||||
allow {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
output "vpc_id" {
|
||||
value = google_compute_network.vpc.id
|
||||
description = "ID du VPC créé"
|
||||
value = google_compute_network.vpc.id
|
||||
}
|
||||
|
||||
output "subnet_ids" {
|
||||
description = "Map des IDs des sous-réseaux"
|
||||
value = {
|
||||
frontend = google_compute_subnetwork.frontend_network.id
|
||||
backend = google_compute_subnetwork.backend_network.id
|
||||
|
||||
@@ -1,36 +1,29 @@
|
||||
variable "project_name" {
|
||||
description = "Nom du projet / préfixe des ressources réseau"
|
||||
type = string
|
||||
description = "but3-iac-dick"
|
||||
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "Région GCP"
|
||||
type = string
|
||||
description = "Région dans laquelle déployer les ressources"
|
||||
|
||||
}
|
||||
|
||||
variable "frontend_cidr" {
|
||||
description = "CIDR for frontend subnet"
|
||||
description = "CIDR pour le subnet frontend"
|
||||
type = string
|
||||
|
||||
}
|
||||
|
||||
variable "backend_cidr" {
|
||||
description = "CIDR for backend subnet"
|
||||
description = "CIDR pour le subnet backend"
|
||||
type = string
|
||||
|
||||
}
|
||||
|
||||
variable "database_cidr" {
|
||||
description = "CIDR for database subnet"
|
||||
description = "CIDR pour le subnet database"
|
||||
type = string
|
||||
|
||||
}
|
||||
|
||||
variable "ssh_source_ranges" {
|
||||
description = "Plage IP autorisée pour le SSH"
|
||||
type = string
|
||||
description = "Plages d’adresses autorisées à se connecter en SSH"
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user