title: Read GCP credentials from Vault in Terraform?
body: <p>Instead of having the GCP credentials somewhere locally, we decided to use Vault to manage them.</p>
  <p>The below code is supposed to do the magic. However, when running <code>terraform plan</code> I always receive an error:</p>
  <pre><code>Error: google: could not find default credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
  </code></pre>
  <p>The code we are using is below:</p>
  <pre><code># Requires env variables VAULT_ADDR and VAULT_TOKEN set.
  provider &quot;vault&quot; {
    token_name = &quot;terraform&quot;
  }
  
  data &quot;vault_generic_secret&quot; &quot;gcp_credentials&quot; {
    path = &quot;kv/terraform/gcp/credentials&quot;
  }
  
  provider &quot;google-beta&quot; {
    credentials = data.vault_generic_secret.gcp_credentials.data_json
    project     = &quot;mip-ppr&quot;
  }
  </code></pre>