hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

data "google_compute_instance" does not fetch the "hostname" #8729

Open ghost opened 3 years ago

ghost commented 3 years ago

Affected Resource(s)

This issue was originally opened by @danislav as hashicorp/terraform#28145. It was migrated here as a result of the provider split. The original body of the issue is below.


Use-cases

When I need to fetch the attributes of a google compute instance with data "google_compute_instance" "some_instance" the hostname attribute of the instance is not fetched from google. The data.google_compute_instance.some_instance.hostname is empty even if is set in GCP.

Attempted Solutions

using gcloud command works: gcloud compute instances describe some_instance --format='get(hostname)' but would be better if the native terraform data source could query the hostname

Proposal

Add hostname to the google_compute_instance data source.

b/359636965

jakubgs commented 2 years ago

I've also experience some weirdness with the hostname field in google_compute_instance. One some instances it exists and updated fine by Terraform, while on others it does not exist and Terraform appears to ignore it entirely.

This includes terraform state show which simply does not show the field on some instances.

ggtisc commented 1 month ago

It isn't currently an available field for google_compute_instance data-source