t
This commit is contained in:
parent
a19d6855b2
commit
d376bf9e98
@ -41,9 +41,9 @@ module "compute" {
|
||||
zone = var.zone
|
||||
instance_type = var.instance_type
|
||||
|
||||
frontend_subnet_id = module.network.id_subnetwork["frontend"]
|
||||
backend_subnet_id = module.network.id_subnetwork["backend"]
|
||||
database_subnet_id = module.network.id_subnetwork["database"]
|
||||
sub1 = module.network.subnet["frontend"]
|
||||
sub2 = module.network.subnet["backend"]
|
||||
sub3 = module.network.subnet["database"]
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ resource "google_compute_instance" "vm-front" {
|
||||
}
|
||||
}
|
||||
network_interface {
|
||||
subnetwork = google_compute_network.frontend_subnet_id
|
||||
subnetwork = var.sub1
|
||||
access_config {} # IP publique
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ resource "google_compute_instance" "vm-back" {
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = google_compute_network.backend_subnet_id
|
||||
subnetwork = var.sub2
|
||||
access_config {} # IP publique
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ resource "google_compute_instance" "vm-database" {
|
||||
}
|
||||
|
||||
network_interface {
|
||||
subnetwork = google_compute_network.database_subnet_id
|
||||
subnetwork = var.sub3
|
||||
access_config {} # IP publique
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,20 @@ variable "database_cidr" {
|
||||
default = "10.0.3.0/24"
|
||||
}
|
||||
|
||||
variable "sub1" {
|
||||
description = "subnet front"
|
||||
type = string
|
||||
}
|
||||
|
||||
|
||||
variable "sub2" {
|
||||
description = "subnet back"
|
||||
type = string
|
||||
}
|
||||
|
||||
|
||||
variable "sub3" {
|
||||
description = "subnet database"
|
||||
type = string
|
||||
}
|
||||
|
||||
|
@ -1 +1,11 @@
|
||||
# Output d'un module
|
||||
output "vpc"{
|
||||
value = google_compute_network.vpc.id
|
||||
}
|
||||
|
||||
output "subnet" {
|
||||
value = {
|
||||
frontend = google_compute_subnetwork.subnet_front.id,
|
||||
backend = google_compute_subnetwork.subnet_back.id,
|
||||
database = google_compute_subnetwork.subnet_db.id
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user