问题描述
我正在terragrunt中部署不同的资源。在同一terragrunt.hcl中,我需要访问同一模块中的输出时,我遇到了问题。
代码示例:
# 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,{})
}
- aws_iam_role.this.arn
- aws_cloudwatch_log_group.this.name
例如,通过dependency
可以很容易地在dependency
-vpc
中访问其他目录中的输出,因为输出位于其他父文件夹中。但是我从未遇到过建议访问同一模块中生成的输出的情况
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)