I need to save the list of all instances of my gcp project into a terraform variable.
On the documentation about the gcp provider I didn’t find any reference on how to do it, but I found that for the aws provider there is a datasource doing exactly this: https://www.terraform.io/docs/providers/aws/d/instances.html
How can I replicate this for gcp?
Hello @aalfodel-opengate,
When you were looking through the documentation, did you notice the google_compute_instance
reference documentation?
If that does not work for your use case, can you elaborate a bit more on the instance information you want to gather.
Sincerely,
Taylor Dolezal
Hello @onlydole,
I’ve already looked through the google_compute_instance
documentation, but it doesn’t contains the piece of information I need.
The google_compute_instance
datasource provides only data about a single GCE instance.
What I need instead is a datasource providing the list of instances on my project.
On AWS I can use the aws_instances
(reference documentation) datasource, but I can’t find the GCP equivalent.
Howdy @aalfodel-opengate,
Ah! Thank you for clarifying. I don’t see something that directly correlates in GCP, and the closest reference I could find was the compute_instance_group
data provider.
Would that work for you, or is there anything else I could help try to find for your context?
Sincerely,
Taylor Dolezal
I think you can’t help me if, in Terraform, there isn’t a GCP equivalent for aws_instances
.
If so, do you know if such an object is scheduled to be added?
Thank you for your replies !
Apologies I couldn’t be of more help, @aalfodel-opengate!
I don’t know of anything on the roadmap (yet) for that functionality, but I would encourage you to open up a GitHub Issue and the engineering team can take a look!
Sincerely,
Taylor Dolezal