2023-11-10 07:32:18 -05:00
|
|
|
locals {
|
|
|
|
region = substr(var.zone, 0, length(var.zone) - 2)
|
|
|
|
}
|
|
|
|
|
|
|
|
module "gcp_iam" {
|
2023-12-11 09:55:44 -05:00
|
|
|
source = "../../infrastructure/iam/gcp"
|
2023-11-10 07:32:18 -05:00
|
|
|
project_id = var.project
|
|
|
|
service_account_id = var.service_account_id
|
|
|
|
region = local.region
|
|
|
|
zone = var.zone
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resource "null_resource" "ensure_yq" {
|
|
|
|
provisioner "local-exec" {
|
|
|
|
command = <<EOT
|
2023-11-13 12:46:20 -05:00
|
|
|
../common/install-yq.sh
|
2023-11-10 07:32:18 -05:00
|
|
|
EOT
|
|
|
|
}
|
|
|
|
triggers = {
|
|
|
|
always_run = timestamp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module "fetch_image" {
|
2023-11-13 12:46:20 -05:00
|
|
|
source = "../common/fetch-image"
|
2023-11-10 07:32:18 -05:00
|
|
|
csp = "gcp"
|
|
|
|
attestation_variant = "gcp-sev-es"
|
|
|
|
image = var.image
|
|
|
|
depends_on = [null_resource.ensure_yq]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module "gcp" {
|
2023-12-11 09:55:44 -05:00
|
|
|
source = "../../infrastructure/gcp"
|
2023-11-10 07:32:18 -05:00
|
|
|
project = var.project
|
|
|
|
image_id = module.fetch_image.image
|
|
|
|
name = var.name
|
|
|
|
node_groups = var.node_groups
|
|
|
|
region = local.region
|
|
|
|
zone = var.zone
|
|
|
|
debug = var.debug
|
|
|
|
custom_endpoint = var.custom_endpoint
|
|
|
|
}
|
|
|
|
|
|
|
|
module "constellation" {
|
|
|
|
source = "../constellation-cluster"
|
|
|
|
csp = "gcp"
|
2023-11-13 12:46:20 -05:00
|
|
|
debug = var.debug
|
2023-11-10 07:32:18 -05:00
|
|
|
name = var.name
|
|
|
|
image = var.image
|
|
|
|
microservice_version = var.microservice_version
|
|
|
|
kubernetes_version = var.kubernetes_version
|
|
|
|
uid = module.gcp.uid
|
|
|
|
clusterEndpoint = module.gcp.out_of_cluster_endpoint
|
|
|
|
inClusterEndpoint = module.gcp.in_cluster_endpoint
|
2023-12-15 04:36:58 -05:00
|
|
|
initSecretHash = module.gcp.init_secret
|
|
|
|
ipCidrNode = module.gcp.ip_cidr_node
|
2023-11-10 07:32:18 -05:00
|
|
|
apiServerCertSANs = module.gcp.api_server_cert_sans
|
|
|
|
node_groups = var.node_groups
|
|
|
|
gcp_config = {
|
|
|
|
region = local.region
|
|
|
|
zone = var.zone
|
|
|
|
project = var.project
|
2023-12-15 04:36:58 -05:00
|
|
|
ipCidrPod = module.gcp.ip_cidr_pod
|
|
|
|
serviceAccountKey = module.gcp_iam.service_account_key
|
2023-11-10 07:32:18 -05:00
|
|
|
}
|
|
|
|
depends_on = [module.gcp, null_resource.ensure_yq]
|
|
|
|
}
|