微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何解决Terraform错误“等待状态变为'done:true'时超时最后一个状态:'done:false',超时:10m0s”?

如何解决如何解决Terraform错误“等待状态变为'done:true'时超时最后一个状态:'done:false',超时:10m0s”?

我正在尝试在GCP中使用terraform创建Firestore索引。 以下是我的terraform脚本:

resource "google_firestore_index" "job_config1_index" {
  project = var.projectId

  collection = var.job_config_firestore
  depends_on = [
    "google_firestore_index.job_config4_index"
  ]

  fields {
    field_path = "customer_id"
    order      = "ASCENDING"
  }

  fields {
    field_path = "job_type"
    order      = "ASCENDING"
  }

  fields {
    field_path = "start_date_time"
    order      = "ASCENDING"
  }

  fields {
    field_path = "__name__"
    order      = "ASCENDING"
  }
}

下面是日志:

Step #2: Error: Error waiting to create Index: Error waiting for Creating Index: timeout while waiting for state to become 'done: true' (last state: 'done: false',timeout: 10m0s)
Step #2: 
Step #2:   on firestore.tf line 298,in resource "google_firestore_index" "job_config1_index":
Step #2:  298: resource "google_firestore_index" "job_config1_index" {
Step #2: 
Step #2: 

我的其他Firestore索引运行良好。 如何增加每个索引的超时时间?

解决方法

包括google_firestore_index资源在内的某些资源具有使用timeouts block创建,更新和/或删除的可选配置超时:

resource "aws_db_instance" "example" {
  # ...

  timeouts {
    create = "60m"
    delete = "2h"
  }
}

因此,在您的情况下,您需要向Firestore索引添加create超时,如下所示:

resource "google_firestore_index" "job_config1_index" {
  project = var.projectId

  collection = var.job_config_firestore
  depends_on = [
    "google_firestore_index.job_config4_index"
  ]

  fields {
    field_path = "customer_id"
    order      = "ASCENDING"
  }

  fields {
    field_path = "job_type"
    order      = "ASCENDING"
  }

  fields {
    field_path = "start_date_time"
    order      = "ASCENDING"
  }

  fields {
    field_path = "__name__"
    order      = "ASCENDING"
  }

  timeouts {
    create = "60m"
  }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。