This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
compute_disk and compute_instance depends on resolveImageImageExists and resolveImageFamilyExists #89
Labels
persistent-bug
Hard to diagnose or long lived bugs for which resolutions are more like feature work than bug work
The configurations of
compute_disk
andcompute_instance
contain the image field which would trigger a call toresolveImageImageExists
andresolveImageFamilyExists
for images in the form ofxyz/xyz
.The logic on
resolveImage
is described in https://github.com/GoogleCloudPlatform/terraform-google-conversion/blob/af8ba4e287cf4b1f5b631dc16ed7b74fb4aff136/google/image.go#L73Since GCP API direct fetching in terraform-google-conversion is being discouraged (@danawillow , @chrisst please correct me if I am wrong), terraform-validator currently does not have the service client initialized, and will cause a panic when the resolveImage*Exists calls are triggered.
I understand that developers may found it useful if image path can be provided using shorthand. But on the other hand, to make a analyser (terraform-validator) to be deterministic against a configuration, I think it is important to guide the developers to provide the full path of an image.
Consider the fact that an image like
debian-8-jessie-v20170523
could mean an image in the project or an image inprojects/debian-cloud/global/images/debian-8-jessie-v20170523
, a potential attacker to the system can create an image inside the project with the same name and then override all the potential deployments afterwards. I think it is important to make the image resolution be deterministic to encourage developers to put a full path there. It is possible to do that by making resolveImage*Exists returns an error if c.clientCompute is not configured, and prompt the user to change the image path to full path format.I want to understand if this is the way to go because this may break existing users (but from the fact that no one reported the issues, I suspect this path is not hit by most users). If so, I can provide the pull request to the upstream dependencies.
The text was updated successfully, but these errors were encountered: