title: How to resolve "Error 409: too much contention on these datastore entities" in terraform?
body: <p>I am new to Terraform. Here, I am trying to create multiple Firestore indexes in <code>GCP</code> using terraform. I get this error <code>Error: Error creating Index: googleapi: Error 409: too much contention on these datastore entities. please try again.</code> What do you mean by <code>too much contention!</code> Below is my Terraform script:</p>
  <pre><code>resource &quot;google_firestore_index&quot; &quot;job_config2_index&quot; {
    project = var.projectId
  
    collection = var.job_config_firestore
  
    fields {
      field_path = &quot;customer_id&quot;
      order      = &quot;ASCENDING&quot;
    }
  
    fields {
      field_path = &quot;job_type&quot;
      order      = &quot;ASCENDING&quot;
    }
  
    fields {
      field_path = &quot;store_id&quot;
      order      = &quot;ASCENDING&quot;
    }
  
    fields {
      field_path = &quot;ms_asset_id&quot;
      order      = &quot;ASCENDING&quot;
    }
  
    fields {
      field_path = &quot;end_date_time&quot;
      order      = &quot;ASCENDING&quot;
    }
  
    fields {
      field_path = &quot;__name__&quot;
      order      = &quot;ASCENDING&quot;
    }
  
    timeouts {
      create = &quot;60m&quot;
    }
  }
  </code></pre>
  <p>Here are the logs:</p>
  <pre><code>Step #2: 
  Step #2: Error: Error creating Index: googleapi: Error 409: too much contention on these datastore entities. please try again.
  Step #2: 
  Step #2:   on firestore.tf line 375, in resource &quot;google_firestore_index&quot; &quot;job_config2_index&quot;:
  Step #2:  375: resource &quot;google_firestore_index&quot; &quot;job_config2_index&quot; {
  Step #2: 
  Step #2: 
  Finished Step #2
  </code></pre>
  <p>How do I resolve this ?</p>