【发布时间】:2021-10-22 22:03:38
【问题描述】:
我很难理解如何反映我在 Terragrunt 中习惯的原生 Terraform 模块实例化结构。采用以下 Terraform 结构,该结构创建 sns topic module 的不同实例。
module "sns_topic" {
source = "terraform-aws-modules/sns/aws"
version = "~> 3.0"
name = "my-topic"
}
module "sns_topic_two" {
source = "terraform-aws-modules/sns/aws"
version = "~> 3.0"
name = "my-topic-two"
content_based_deduplication = true
}
module "sns_topic_three" {
source = "terraform-aws-modules/sns/aws"
version = "~> 3.0"
name = "my-topic-three"
http_success_feedback_role_arn = x
http_success_feedback_sample_rate = y
http_failure_feedback_role_arn = z
}
...
任何fields in the module itself 都可以填充该模块的给定实例。
对于模块的每个实例可能因字段使用而异的情况,我不明白如何在 Terragrunt via their Inputs 中完成此操作。例如,在 sns 模块中,您可以拥有使用 content_based_deduplication 的主题 A 和使用 lambda_success_feedback_role_arn 的主题 B 和使用完全不同的字段的主题 C,并且您可能在环境中有 100 个不同的主题。在本机 Terraform 中,您只需实例化每个模块,如上所示。但是如何通过 Terragrunt 做到这一点?
【问题讨论】:
标签: terraform terragrunt