Compare commits
No commits in common. "5a738414d87b0512d1ddeefe7fec320c6562cd14" and "776ff0b901d46163b8ecdbdc95a89b75f9748eab" have entirely different histories.
5a738414d8
...
776ff0b901
@ -1,47 +1,48 @@
|
||||
variable "project_name" {
|
||||
description = "Nom du projet"
|
||||
description = "ID du projet GCP"
|
||||
type = string
|
||||
default = "tp-1-docker"
|
||||
default = "iut fbleau tp"
|
||||
}
|
||||
|
||||
variable "project_id" {
|
||||
description = "ID du projet"
|
||||
description = "ID du projet GCP"
|
||||
type = string
|
||||
default = "tp-1-docker"
|
||||
default = "iut fbleau tp"
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "Région du projet"
|
||||
description = "region du projet"
|
||||
type = string
|
||||
default = "europe-west4"
|
||||
default = "europe-west9"
|
||||
}
|
||||
|
||||
|
||||
variable "frontend_cidr" {
|
||||
description = "cidr du frontend"
|
||||
description = "frontend"
|
||||
type = string
|
||||
default = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
variable "backend_cidr" {
|
||||
description = "cidr du backend"
|
||||
description = "backend"
|
||||
type = string
|
||||
default = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
variable "database_cidr" {
|
||||
description = "cidr du database"
|
||||
description = "database"
|
||||
type = string
|
||||
default = "10.0.3.0/24"
|
||||
}
|
||||
|
||||
variable "ssh_source_ranges" {
|
||||
description = "Accès à internet"
|
||||
description = "acces par ssh"
|
||||
type = string
|
||||
default = "0.0.0.0/0"
|
||||
}
|
||||
|
||||
variable "cidr_range" {
|
||||
description = "cidr de network"
|
||||
description = "cidr-network"
|
||||
type = string
|
||||
default = "10.0.0.0/16"
|
||||
}
|
||||
}
|
||||
|
@ -1,69 +0,0 @@
|
||||
resource "google_compute_instance" "frontend" {
|
||||
name = "ma-vm-frontend"
|
||||
machine_type = var.instance_type
|
||||
zone = var.zone
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = var.frontend_subnet_id
|
||||
access_config {} # IP publique
|
||||
}
|
||||
|
||||
tags = ["frontend", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "backend" {
|
||||
name = "ma-vm-backend"
|
||||
machine_type = var.instance_type
|
||||
zone = var.zone
|
||||
|
||||
boot_disk {
|
||||
initialize_params {
|
||||
image = "debian-cloud/debian-11"
|
||||
size = 10
|
||||
}
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = var.backend_subnet_id
|
||||
}
|
||||
|
||||
tags = ["backend", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "database" {
|
||||
name = "ma-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.database_subnet_id
|
||||
}
|
||||
|
||||
tags = ["database", "ssh"]
|
||||
|
||||
metadata = {
|
||||
enable-oslogin = "TRUE"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
output "instance_names" {
|
||||
description = "Noms des instances"
|
||||
value = {
|
||||
frontend = google_compute_instance.frontend.name
|
||||
backend = google_compute_instance.backend.name
|
||||
database = google_compute_instance.database.name
|
||||
}
|
||||
}
|
||||
|
||||
output "frontend_public_ip" {
|
||||
value = google_compute_instance.frontend.network_interface[0].access_config[0].nat_ip
|
||||
}
|
||||
|
||||
output "private_ip" {
|
||||
description = "IPs internes de toutes les instances"
|
||||
value = {
|
||||
frontend = google_compute_instance.frontend.network_interface[0].network_ip
|
||||
backend = google_compute_instance.backend.network_interface[0].network_ip
|
||||
database = google_compute_instance.database.network_interface[0].network_ip
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
variable "instance_type" {
|
||||
description = "les types d'instances"
|
||||
type = string
|
||||
default = "e2-micro"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
description = "zone des instances"
|
||||
type = string
|
||||
default = "europe-west4"
|
||||
}
|
||||
|
||||
variable "frontend_subnet_id" {
|
||||
description = "L'identifiant du subnet utilisé pour le frontend"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "backend_subnet_id" {
|
||||
description = "L'identifiant du subnet utilisé pour le backend"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "database_subnet_id" {
|
||||
description = "L'identifiant du subnet utilisé pour la database"
|
||||
type = string
|
||||
}
|
Loading…
Reference in New Issue
Block a user