forked from pierront/but3-iac
Problème avec Compute : subnet
This commit is contained in:
42
tp-cloud/terraform/environments/dev/main.tf
Normal file
42
tp-cloud/terraform/environments/dev/main.tf
Normal file
@@ -0,0 +1,42 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
version = "~> 6.0"
|
||||
}
|
||||
}
|
||||
required_version = ">= 1.0.0"
|
||||
}
|
||||
|
||||
provider "google" {
|
||||
project = var.project
|
||||
region = var.region
|
||||
zone = var.zone
|
||||
}
|
||||
|
||||
module "network" {
|
||||
source = "../../modules/network"
|
||||
project = var.project
|
||||
region = var.region
|
||||
frontend_cidr = "10.10.1.0/24"
|
||||
backend_cidr = "10.10.2.0/24"
|
||||
database_cidr = "10.10.3.0/24"
|
||||
ssh_source_ranges = var.ssh_source_ranges
|
||||
}
|
||||
|
||||
module "iam" {
|
||||
source = "../../modules/iam"
|
||||
project = var.project
|
||||
}
|
||||
|
||||
module "compute" {
|
||||
source = "../../modules/compute"
|
||||
project = var.project
|
||||
zone = var.zone
|
||||
instance_type = "e2-small"
|
||||
frontend_subnet_id = module.network.subnet_ids["frontend"]
|
||||
backend_subnet_id = module.network.subnet_ids["backend"]
|
||||
database_subnet_id = module.network.subnet_ids["database"]
|
||||
os_login = true
|
||||
}
|
||||
|
||||
16
tp-cloud/terraform/environments/dev/outputs.tf
Normal file
16
tp-cloud/terraform/environments/dev/outputs.tf
Normal file
@@ -0,0 +1,16 @@
|
||||
output "frontend_public_ip" {
|
||||
value = module.compute.frontend_public_ip
|
||||
}
|
||||
|
||||
output "internal_ips" {
|
||||
value = module.compute.internal_ips
|
||||
}
|
||||
|
||||
output "vpc_id" {
|
||||
value = module.network.vpc_id
|
||||
}
|
||||
|
||||
output "service_account_email" {
|
||||
value = module.iam.service_account_email
|
||||
}
|
||||
|
||||
19
tp-cloud/terraform/environments/dev/variables.tf
Normal file
19
tp-cloud/terraform/environments/dev/variables.tf
Normal file
@@ -0,0 +1,19 @@
|
||||
variable "project" {
|
||||
type = string
|
||||
default = "projet-hugo-478713"
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
type = string
|
||||
default = "europe-west9"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
default = "europe-west9-b"
|
||||
}
|
||||
|
||||
variable "ssh_source_ranges" {
|
||||
type = list(string)
|
||||
default = ["0.0.0.0/0"]
|
||||
}
|
||||
Reference in New Issue
Block a user