terraform-google-modules / terraform-google-cloud-datastore

Manages Datastore
https://registry.terraform.io/modules/terraform-google-modules/cloud-datastore/google
Apache License 2.0
22 stars 33 forks source link

Gcloud: command not found #17

Closed gregseed closed 4 years ago

gregseed commented 4 years ago

Hi all,

I am trying to run this module in a GitLab cicd I am encountering the following error. Has anybody seen this before?

terraform: 0.12.12 terraform-google-cloud-datastore: 1.0.0

(disregard the use of serviceaccount here, just trying to mess around with different combinations)

Error running command '.terraform/modules/datastore/terraform-google-modules-terraform-google-cloud-datastore-9bd52e3/scripts/create-indexes.sh 'xxxxx@the-project.iam.gserviceaccount.com' 'the-project' '.terraform/modules/datastore/terraform-google-modules-terraform-google-cloud-datastore-9bd52e3/tmp/index.yaml'': exit status 127. Output: .terraform/modules/datastore/terraform-google-modules-terraform-google-cloud-datastore-9bd52e3/scripts/create-indexes.sh: line 30: gcloud: command not found

and the datastore.tf file:

locals {
  firestore_indexes_path = './yaml/firestore/index.yaml'
}
module "datastore" {
  source      = "terraform-google-modules/cloud-datastore/google"
  credentials = google_service_account.firestore-sa.email
  project     = "${data.google_project.project.project_id}"
  indexes     = "${local.firestore_indexes_path}"
}

Also of note when I try and run it locally I get a slightly different error:

Error running command '.terraform/modules/datastore/terraform-google-modules-terraform-google-cloud-datastore-9bd52e3/scripts/create-indexes.sh 'firestore-sa@the-project.iam.gserviceaccount.com' 'the-project' '.terraform/modules/datastore/terraform-google-modules-terraform-google-cloud-datastore-9bd52e3/tmp/index.yaml'': exit status 1. Output: '.terraform' is not recognized as an internal or external command,
operable program or batch file.

Any ideas?

morgante commented 4 years ago

You need to install the gcloud CLI in your execution environment: https://cloud.google.com/sdk/gcloud/

Once you have it installed, this should work. Let us know if it doesn't.