fin du tp terraform
This commit is contained in:
BIN
modules/network/.outputs.tf.swp
Normal file
BIN
modules/network/.outputs.tf.swp
Normal file
Binary file not shown.
@@ -6,22 +6,22 @@ resource "google_compute_network" "vpc" {
|
||||
resource "google_compute_subnetwork" "front" {
|
||||
name = "frontend"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.1.0/24"
|
||||
region = "europe-west1-b"
|
||||
ip_cidr_range = var.frontend_cidr
|
||||
region = var.region
|
||||
}
|
||||
|
||||
resource "google_compute_subnetwork" "backend" {
|
||||
name = "backend"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.2.0/24"
|
||||
region = "europe-west1-b"
|
||||
ip_cidr_range = var.backend_cidr
|
||||
region = var.region
|
||||
}
|
||||
|
||||
resource "google_compute_subnetwork" "database" {
|
||||
name = "database"
|
||||
network = google_compute_network.vpc.id
|
||||
ip_cidr_range = "10.0.3.0/24"
|
||||
region = "europe-west1"
|
||||
ip_cidr_range = var.database_cidr
|
||||
region = var.region
|
||||
}
|
||||
|
||||
resource "google_compute_firewall" "allow_http" {
|
||||
@@ -33,6 +33,8 @@ resource "google_compute_firewall" "allow_http" {
|
||||
ports = ["80", "443"]
|
||||
}
|
||||
target_tags = ["frontend"]
|
||||
source_ranges = [ var.http_source_ranges ]
|
||||
|
||||
}
|
||||
|
||||
resource "google_compute_firewall" "allow_ssh" {
|
||||
@@ -43,7 +45,7 @@ resource "google_compute_firewall" "allow_ssh" {
|
||||
protocol = "tcp"
|
||||
ports = ["22"]
|
||||
}
|
||||
source_ranges = [var.ssh_source_ranges]
|
||||
source_ranges = [ var.ssh_source_ranges ]
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
output "vpc_id" {
|
||||
value = google_compute_network.vpc.id
|
||||
}
|
||||
|
||||
output "subnets_ids"{
|
||||
value = {
|
||||
frontend = google_compute_subnetwork.front.id,
|
||||
backend = google_compute_subnetwork.backend.id,
|
||||
database = google_compute_subnetwork.database.id
|
||||
}
|
||||
}
|
||||
|
@@ -1,14 +1,21 @@
|
||||
# modules/network/variables.tf
|
||||
|
||||
variable "project_name" {
|
||||
description = "Nom du projet Google Cloud"
|
||||
variable "projet_id" {
|
||||
description = "ID du projet GCP"
|
||||
type = string
|
||||
default = "automatisation-tp1"
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "Région Google Cloud"
|
||||
description = "region des vms"
|
||||
type = string
|
||||
default = "europe-west1-b"
|
||||
}
|
||||
|
||||
variable "project_name" {
|
||||
description = "Nom du projet Google Cloud"
|
||||
type = string
|
||||
default = "automatisation-tp1"
|
||||
}
|
||||
|
||||
variable "frontend_cidr" {
|
||||
@@ -34,3 +41,9 @@ variable "ssh_source_ranges" {
|
||||
type = string
|
||||
default = "0.0.0.0/0"
|
||||
}
|
||||
|
||||
variable "http_source_ranges" {
|
||||
description = "source ranges"
|
||||
type = string
|
||||
default = "0.0.0.0/0"
|
||||
}
|
||||
|
Reference in New Issue
Block a user