{
  "id": "terraform/dynamic-block-iterator-invalid",
  "signature": "Error: Invalid dynamic block iterator: The iterator for a dynamic block must be a single word, not a complex expression",
  "signature_zh": "错误：无效的动态块迭代器：动态块的迭代器必须是单个单词，不能是复杂表达式",
  "regex": "Invalid dynamic block iterator.*must be a single word",
  "domain": "terraform",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The dynamic block's iterator argument is set to a complex expression (like a function call or attribute reference) instead of a simple variable name.",
  "root_cause_type": "generic",
  "root_cause_zh": "动态块的 iterator 参数被设置为复杂表达式（如函数调用或属性引用），而不是简单的变量名。",
  "versions": [
    {
      "version": "Terraform 1.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform 1.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Terraform 1.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The iterator must be a new variable name, not an existing expression. Terraform uses it to create a temporary variable within the block.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The default iterator 'each' works only if not already used by another dynamic block in the same resource. If 'each' is used elsewhere, it causes conflicts.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The iterator must be an unquoted identifier, not a string. Quoting makes it a string literal, which is not a valid variable name.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a simple, single-word identifier for the iterator that is not already in use in the current scope. For example, if iterating over a list of tags, use 'tag' as the iterator.",
      "success_rate": 0.95,
      "how": "Use a simple, single-word identifier for the iterator that is not already in use in the current scope. For example, if iterating over a list of tags, use 'tag' as the iterator.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If you have nested dynamic blocks, use distinct iterator names for each level, such as 'outer' and 'inner'.",
      "success_rate": 0.9,
      "how": "If you have nested dynamic blocks, use distinct iterator names for each level, such as 'outer' and 'inner'.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用一个简单的、单词的标识符作为迭代器，且该标识符在当前作用域中未被使用。例如，如果遍历标签列表，使用 'tag' 作为迭代器。",
    "如果有嵌套的动态块，为每一层使用不同的迭代器名称，例如 'outer' 和 'inner'。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}