avx-pmarie-aws-infra/infra/aws-load-balancer-controller/terragrunt.hcl

54 lines
2.0 KiB
HCL
Raw Permalink Normal View History

2022-07-01 14:12:11 +02:00
include "root" {
path = find_in_parent_folders()
}
terraform {
source = "${get_repo_root()}//modules/eks-aws-load-balancer-controller"
}
dependency "eks" {
config_path = "../eks"
# Configure mock outputs for the `validate` and `plan` commands that are returned when there are no outputs available
# (e.g the module hasn't been applied yet)
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
mock_outputs = {
cluster_id = "fake-cluster-id"
cluster_endpoint = "https://fake-cluster-endpoint.eks.amazonaws.com"
cluster_certificate_authority_data = "ZmFrZS1jYS1jZXJ0LWRhdGE="
}
}
dependency "iam" {
config_path = "../aws-load-balancer-iam-aws"
mock_outputs_allowed_terraform_commands = ["validate", "plan"]
mock_outputs = {
aws_iam_roles_arns = {
"${local.iam_role_prefix}Dev" = "arn:aws:iam::505686222560:role/${local.iam_role_prefix}Dev"
"${local.iam_role_prefix}Staging" = "arn:aws:iam::505686222560:role/${local.iam_role_prefix}Staging"
"${local.iam_role_prefix}Prod" = "arn:aws:iam::505686222560:role/${local.iam_role_prefix}Prod"
}
}
}
locals {
config_vars = read_terragrunt_config(find_in_parent_folders("config.hcl"))
env = local.config_vars.locals.environment
namespace = local.config_vars.locals.aws_load_balancer_namespace
iam_role_prefix = local.config_vars.locals.aws_load_balancer_iam_role_prefix
service_account_name = local.config_vars.locals.aws_load_balancer_service_account_name
}
inputs = {
cluster_id = dependency.eks.outputs.cluster_id
cluster_endpoint = dependency.eks.outputs.cluster_endpoint
cluster_certificate_authority_data = dependency.eks.outputs.cluster_certificate_authority_data
environment = local.env
iam_role_arn = dependency.iam.outputs.aws_iam_roles_arns["${local.iam_role_prefix}${title(local.env)}"]
namespace = local.namespace
service_account_name = local.service_account_name
}