我有一個terraform計劃,它由多個aws_sqs_queue
資源組成,它們更少或更少共享相同的配置。在我刪除任何重複的配置並使用變量之前,我想運行terraform plan
以查看它是否有效。但我一直碰到 -Terraform - 資源重複多次
module root: 1 error(s) occurred:
* data.template_file.ep_match_result_queues: resource repeated multiple times
我試過Google搜索,但沒有太多的信息可用。任何幫助都感激不盡。我的計劃是這樣的:(忽略多餘的括號,錯別字,因爲這僅僅是一個框架給你一個總體思路的計劃是如何sturctured):
data "template_file" "ep_match_result_queues" {
template = "${var.namespace}-sm-ep"
}
resource "aws_sns_topic" "sns_topic_name" {
name = "ep_sm_match_result_topic${var.environment}"
display_name = ""
policy = <<POLICY
{
#policy
}
resource "aws_sqs_queue" "queue1" {
#config
}
resource "aws_sqs_queue" "queue2" {
#config
redrive_policy = <<POLICY
{
#policy
}
POLICY
}
resource "aws_sqs_queue" "queue3" {
#config
}
resource "aws_sqs_queue" "queue4" {
#config
redrive_policy = <<POLICY
{
#policy
}
POLICY
}
resource "aws_sqs_queue" "queue5" {
#config
}
resource "aws_sqs_queue" "queue6" {
#config
redrive_policy = <<POLICY
{
#policy
}
POLICY
}
resource "aws_sqs_queue" "queue7" {
#config
}
resource "aws_sqs_queue" "queue8" {
#config
redrive_policy = <<POLICY
{
#policy
}
POLICY
}
resource "aws_sqs_queue_policy" "queue_policy" {
queue_url = [ ... ]
policy = "${data.aws_iam_policy_document.match_result_queues_policy.json}"
}
data "aws_iam_policy_document" "match_result_queues_policy" {
#policy
}