Terragrunt - How use outputs values in the same module

718 views Asked by At

I am deploying different resources in terragrunt. I have a problem when in the same terragrunt.hcl I need access a ouputs generete in the same module.

CODE EXAMPLE:

# Include VPC outputs as this module is a dependency
dependency "vpc" {
  config_path = "../../../vpc"
}

inputs = {
  name = "nginx"

  vpc_id          = dependency.vpc.outputs.vpc_id
  vpc_subnets     = dependency.vpc.outputs.private_subnets
  security_groups = [dependency.sg-redis-access.outputs.id]

  tg_port       = 80
  tg_protocol   = "HTTP"

  service_ecs_cluster_arn                    = dependency.ecs-cluster.outputs.cluster_arn
  service_desired_count                      = 1
  service_deployment_minimum_healthy_percent = 0

  task_definition_execution_role = aws_iam_role.this.arn
  task_definition_container_definitions = templatefile("task_definition.json", {
    name                  = "nginx"
    awslogs_group         = aws_cloudwatch_log_group.this.name
    awslogs_region        = local.region_vars.locals.aws_region
    awslogs_stream_prefix = "nginx"
  })

  tags = merge(local.account_vars.locals.account_tags, local.region_vars.locals.region_tags, {})
}

I need extract the values generates in the same module for:

  • aws_iam_role.this.arn
  • aws_cloudwatch_log_group.this.name

For example to access outputs in other directories is to easy with dependency how I do in the dependency - vpc, because the outputs are in other parent folder. But I have never had the case that I propose to access ouputs generated in the same module

0

There are 0 answers