2023-11-08 13:10:01 -05:00
|
|
|
locals {
|
|
|
|
region = substr(var.zone, 0, length(var.zone) - 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
module "aws_iam" {
|
2023-12-11 09:55:44 -05:00
|
|
|
source = "../../infrastructure/iam/aws"
|
2023-11-08 13:10:01 -05:00
|
|
|
name_prefix = var.name_prefix
|
|
|
|
region = local.region
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "null_resource" "ensure_yq" {
|
|
|
|
provisioner "local-exec" {
|
|
|
|
command = <<EOT
|
2023-11-13 12:46:20 -05:00
|
|
|
../common/install-yq.sh
|
2023-11-08 13:10:01 -05:00
|
|
|
EOT
|
|
|
|
}
|
|
|
|
triggers = {
|
|
|
|
always_run = timestamp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-10 07:32:18 -05:00
|
|
|
module "fetch_image" {
|
2023-11-13 12:46:20 -05:00
|
|
|
source = "../common/fetch-image"
|
2023-11-10 07:32:18 -05:00
|
|
|
csp = "aws"
|
2023-11-08 13:10:01 -05:00
|
|
|
attestation_variant = var.enable_snp ? "aws-sev-snp" : "aws-nitro-tpm"
|
|
|
|
region = local.region
|
|
|
|
image = var.image
|
|
|
|
depends_on = [module.aws_iam, null_resource.ensure_yq]
|
|
|
|
}
|
|
|
|
|
|
|
|
module "aws" {
|
2023-12-11 09:55:44 -05:00
|
|
|
source = "../../infrastructure/aws"
|
2023-11-08 13:10:01 -05:00
|
|
|
name = var.name
|
|
|
|
node_groups = var.node_groups
|
|
|
|
iam_instance_profile_worker_nodes = module.aws_iam.worker_nodes_instance_profile
|
|
|
|
iam_instance_profile_control_plane = module.aws_iam.control_plane_instance_profile
|
2023-11-10 07:32:18 -05:00
|
|
|
ami = module.fetch_image.image
|
2023-11-08 13:10:01 -05:00
|
|
|
region = local.region
|
|
|
|
zone = var.zone
|
|
|
|
debug = var.debug
|
|
|
|
enable_snp = var.enable_snp
|
|
|
|
custom_endpoint = var.custom_endpoint
|
|
|
|
}
|
|
|
|
|
|
|
|
module "constellation" {
|
|
|
|
source = "../constellation-cluster"
|
|
|
|
csp = "aws"
|
2023-11-13 12:46:20 -05:00
|
|
|
debug = var.debug
|
2023-11-08 13:10:01 -05:00
|
|
|
name = var.name
|
|
|
|
image = var.image
|
|
|
|
microservice_version = var.microservice_version
|
|
|
|
kubernetes_version = var.kubernetes_version
|
|
|
|
uid = module.aws.uid
|
|
|
|
clusterEndpoint = module.aws.out_of_cluster_endpoint
|
|
|
|
inClusterEndpoint = module.aws.in_cluster_endpoint
|
|
|
|
initSecretHash = module.aws.initSecret
|
|
|
|
ipCidrNode = module.aws.ip_cidr_nodes
|
|
|
|
apiServerCertSANs = module.aws.api_server_cert_sans
|
|
|
|
node_groups = var.node_groups
|
|
|
|
aws_config = {
|
|
|
|
region = local.region
|
|
|
|
zone = var.zone
|
|
|
|
iam_instance_profile_worker_nodes = module.aws_iam.worker_nodes_instance_profile
|
|
|
|
iam_instance_profile_control_plane = module.aws_iam.control_plane_instance_profile
|
|
|
|
}
|
|
|
|
depends_on = [module.aws, null_resource.ensure_yq]
|
|
|
|
}
|