forked from pierront/but3-iac
ajout computes
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
# À vous de créer :
|
||||
# 1. Un VPC personnalisé avec auto_create_subnetworks = false
|
||||
# 2. Trois sous-réseaux (frontend, backend, database)
|
||||
# 3. Règles de firewall :
|
||||
# - HTTP/HTTPS vers frontend
|
||||
# - SSH vers toutes les instances
|
||||
# - Port 8000 de frontend vers backend
|
||||
# - Port 3306 de backend vers database
|
||||
|
||||
# VPC
|
||||
# # VPC
|
||||
# resource "google_compute_network" "vpc" {
|
||||
# name = "mon-vpc"
|
||||
# auto_create_subnetworks = false
|
||||
# }
|
||||
resource "google_compute_network" "vpc_terraform" {
|
||||
name = "vpc-terraform"
|
||||
auto_create_subnetworks = false
|
||||
}
|
||||
|
||||
# Sous-réseau
|
||||
# # Sous-réseau
|
||||
# resource "google_compute_subnetwork" "subnet" {
|
||||
# name = "mon-subnet"
|
||||
# network = google_compute_network.vpc.id
|
||||
# ip_cidr_range = "10.0.1.0/24"
|
||||
# region = "europe-west1"
|
||||
# }
|
||||
resource "google_compute_subnetwork" "subnet_frontend" {
|
||||
name = "frontend"
|
||||
network = google_compute_network.vpc_terraform.id
|
||||
@@ -35,6 +36,19 @@ resource "google_compute_subnetwork" "subnet_database" {
|
||||
region = var.region
|
||||
}
|
||||
|
||||
# resource "google_compute_firewall" "allow_http" {
|
||||
# name = "allow-http"
|
||||
# network = google_compute_network.vpc.id
|
||||
|
||||
# allow {
|
||||
# protocol = "tcp"
|
||||
# ports = ["80", "443"]
|
||||
# }
|
||||
|
||||
# source_ranges = ["0.0.0.0/0"]
|
||||
# target_tags = ["web"]
|
||||
# }
|
||||
|
||||
resource "google_compute_firewall" "allow_user_frontend" {
|
||||
name = "allow-user-frontend"
|
||||
network = google_compute_network.vpc_terraform.id
|
||||
|
||||
Reference in New Issue
Block a user