【问题标题】:How to resolve the terraform error "timeout while waiting for state to become 'done: true' (last state: 'done: false', timeout: 10m0s)"?如何解决 terraform 错误“等待状态变为‘完成:真’时超时(最后状态:‘完成:假’,超时:10m0s)”?
【发布时间】:2020-12-13 02:19:32
【问题描述】:

我正在尝试在 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-cloud-platform terraform terraform-provider-gcp


    【解决方案1】:

    包括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"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-04
      • 2017-08-26
      • 2021-10-16
      • 2019-07-07
      • 1970-01-01
      • 1970-01-01
      • 2020-11-17
      • 2019-05-15
      相关资源
      最近更新 更多