You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Terraform中evaluation_missing_data参数未预期报错问题求助

问题分析与解决

报错核心原因

你遇到的"An argument named "evaluation_missing_data" is not expected here"错误,根源是参数层级放置错误。

以GCP监控告警策略资源(如google_monitoring_alert_policy)为例,evaluation_missing_data是告警策略的顶层参数,而非嵌套在condition_threshold块内部的配置项。你当前把它写在condition_threshold的content块里,Terraform无法识别该位置的这个参数。

修正后的代码示例

将evaluation_missing_data移到condition_threshold块的外部,作为告警策略的顶层参数配置:

dynamic "condition_threshold" {
  for_each = conditions.value.metric_absence != true ? [conditions.value] : []
  content {
    filter                  = condition_threshold.value.filter
    comparison              = condition_threshold.value.comparison
    threshold_value         = condition_threshold.value.threshold_value
    duration                = condition_threshold.value.duration
    trigger {
      count   = conditions.value.trigger_percentage == null ? conditions.value.trigger_count : null
      percent = conditions.value.trigger_percentage
    }
    aggregations {
      alignment_period     = condition_threshold.value.alignment_period
      per_series_aligner   = condition_threshold.value.per_series_aligner
      cross_series_reducer = condition_threshold.value.cross_series_reducer
      group_by_fields      = condition_threshold.value.group_by_fields
    }
  }
}
# 移至此处作为告警策略顶层参数
evaluation_missing_data = "EVALUATION_MISSING_DATA_INACTIVE"

额外排查方向

  • 确认资源类型适配:检查你使用的Terraform资源是否确实支持evaluation_missing_data参数,比如google_monitoring_alert_policy支持该参数,部分其他监控类资源可能不兼容。
  • 检查Provider版本:除了Terraform核心版本,也要对应检查hashicorp/google Provider的版本,旧版本Provider可能未引入该参数或参数位置有差异,建议升级到最新稳定版。

内容的提问来源于stack exchange,提问作者Shreshth.K

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 19:35:20