The Facade
Shield initiates from the blinding complexity of the raw cloud by providing a simplified, unified invocation interface.
# The Facade exposes only the bare minimum to the user
variable "project_name" {
type = string
}
variable "is_production" {
type = bool
default = false
}
# Behind the veil, a storm of complexity is orchestrated
module "networking" {
source = "./modules/vpc_complex"
name = "${var.project_name}-net"
tiers = var.is_production ? 3 : 1
}
module "database" {
source = "./modules/rds_aurora"
vpc_id = module.networking.vpc_id
ha = var.is_production
}
module "compute" {
source = "./modules/eks_cluster"
vpc_id = module.networking.vpc_id
nodes = var.is_production ? 5 : 1
}
output "endpoint" {
value = module.compute.cluster_endpoint
}
The Facade: The Simplification Sigil
A vast AWS deployment contains hundreds of interlinked resources: route tables, NAT gateways, IAM roles, and security groups. Exposing these to an apprentice is a recipe for catastrophic miscasts.
The Facade pattern is the creation of a “Root Module” designed entirely for human consumption. It distills thousands of lines of infrastructure code down to two or three hyper-semantic variables (e.g., project_name and is_production). The Facade module internally acts as the grand conductor, routing these simple truths into the complex parameters of its hidden child modules. The user simply asks for “Production,” and the Facade ensures the magic is woven correctly.