Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Google DataStore indexes resource #60

Closed
hashibot opened this issue Jun 13, 2017 · 7 comments · Fixed by GoogleCloudPlatform/magic-modules#3085, #5655 or hashicorp/terraform-provider-google-beta#1755

Comments

@hashibot
Copy link

This issue was originally opened by @vise890 as hashicorp/terraform#12341. It was migrated here as part of the provider split. The original body of the issue is below.


This would be really helpful to avoid resorting to bash scripts that basically run a

gcloud datastore create-indexes ./indexes.yaml
@rosbo
Copy link
Contributor

rosbo commented Jan 10, 2018

Hi @vise890,

What is your use case exactly?

Thank you

@vise890-ovo
Copy link

Anything that requires an index.yamls really.

A bit more motivation is provided in the DS index docs:

Other forms of query require their indexes to be specified in the index configuration file, including:

  • Queries with ancestor and inequality filters
  • Queries with one or more inequality filters on a property and one or more equality filters on other properties
  • Queries with a sort order on keys in descending order
  • Queries with multiple sort orders

.. If you need to have any of these, you need an index.yaml. Right now this is checked into the repo and it is a manual process to apply it. It'd be awesome to have it integrated in terraform.

@premkumar-masilamani
Copy link

Hi - Is there any progress on this?. Do I still have to manually run this using glcloud CLI?

@rosbo
Copy link
Contributor

rosbo commented Mar 7, 2018

We haven't made progress on this yet. Linking to the AppEngine issue because we might want to tackle both together: #638.

@premkumar-masilamani
Copy link

Thanks, @rosbo . Just in case anyone is looking to manage cloud datastore indices using terraform, here is what I did.

This needs an ENV variable TF_VAR_GOOGLE_APPLICATION_CREDENTIALS pointing to the location of the Service Account JSON file.

Anytime the index.yaml file is updated, the below code will be executed.

data "local_file" "cloud-datastore-composite-indices" {
  filename = "../../configurations/cloud-datastore/index.yaml"
}

resource "null_resource" "gcloud-activate-service-account" {
  triggers {
    changes_in_index_file = "${sha1(file("${data.local_file.cloud-datastore-composite-indices.filename}"))}"
  }
  provisioner "local-exec" {
    command = "gcloud auth activate-service-account --key-file=${var.GOOGLE_APPLICATION_CREDENTIALS}"
  }
}

resource "null_resource" "cloud-datastore-cleanup-indices" {
  triggers {
    changes_in_index_file = "${sha1(file("${data.local_file.cloud-datastore-composite-indices.filename}"))}"
  }
  provisioner "local-exec" {
    command = "gcloud datastore cleanup-indexes ${data.local_file.cloud-datastore-composite-indices.filename} --project=${var.google_project_id}"
  }
  depends_on = ["null_resource.gcloud-activate-service-account"]
}

resource "null_resource" "cloud-datastore-create-indices" {
  triggers {
    changes_in_index_file = "${sha1(file("${data.local_file.cloud-datastore-composite-indices.filename}"))}"
  }
  provisioner "local-exec" {
    command = "gcloud datastore create-indexes ${data.local_file.cloud-datastore-composite-indices.filename} --project=${var.google_project_id}"
  }
  depends_on = ["null_resource.gcloud-activate-service-account"]
}

@morgante
Copy link

morgante commented May 25, 2018

My team is working on a temporary workaround module.

@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.