include "root" { path = find_in_parent_folders() } locals { repo_root = try(get_repo_root(), "${get_terragrunt_dir()}/../..") infra_config = yamldecode(file("${local.repo_root}/infrastructure.yaml")) env_override = trimspace(get_env("INFRA_ENV", "")) env_from_file = try(trimspace(local.infra_config.current_environment), "") available_envs = sort(keys(try(local.infra_config.environments, {}))) env_fallback = try(local.available_envs[0], "") env_name = local.env_override != "" ? local.env_override : ( local.env_from_file != "" ? local.env_from_file : local.env_fallback ) env_config = try(local.infra_config.environments[local.env_name], {}) } remote_state { backend = "s3" generate = { path = "backend.tf" if_exists = "overwrite_terragrunt" } config = { endpoint = get_env("TF_STATE_S3_ENDPOINT", "") bucket = get_env("TF_STATE_S3_BUCKET", "") key = "${local.env_name}/rabbitmq/terraform.tfstate" region = get_env("TF_STATE_S3_REGION", "ru-central1") access_key = get_env("S3_ACCESS_KEY", get_env("AWS_ACCESS_KEY_ID", "")) secret_key = get_env("S3_SECRET_KEY", get_env("AWS_SECRET_ACCESS_KEY", "")) skip_region_validation = true skip_credentials_validation = true skip_metadata_api_check = true skip_bucket_root_access = true force_path_style = true } } terraform { source = "${get_terragrunt_dir()}/../../modules//rabbitmq" } inputs = { environment = local.env_name management_endpoint = get_env("RABBITMQ_ENDPOINT", "http://rabbitmq.rabbitmq.svc.cluster.local:15672") management_username = get_env("RABBITMQ_ADMIN_USER", "admin") management_password = get_env("RABBITMQ_ADMIN_PASSWORD", "") amqp_host = try(local.env_config.rabbitmq.amqp_host, "rabbitmq.rabbitmq.svc.cluster.local") amqp_port = try(local.env_config.rabbitmq.amqp_port, 5672) vhosts = try(local.env_config.rabbitmq.vhosts, []) users = try(local.env_config.rabbitmq.users, []) permissions = try(local.env_config.rabbitmq.permissions, []) topic_permissions = try(local.env_config.rabbitmq.topic_permissions, []) exchanges = try(local.env_config.rabbitmq.exchanges, []) queues = try(local.env_config.rabbitmq.queues, []) bindings = try(local.env_config.rabbitmq.bindings, []) policies = try(local.env_config.rabbitmq.policies, []) }