Open sourabhxyz opened 5 years ago
b/262698141
Resource Name - google_storage_bucket_object
API Docs -
Notes -
md5Hash
in the resource representation. However, there isn't a field that can provide the md5 hash in hexadecimal form.md5HexHash
. Its value can be obtained from the md5Hash
by converting base64 to hex.Possible conversion from base64
to hex
for md5Hash
:
// decode first
p, err := base64.StdEncoding.DecodeString(response["md5Hash"])
if err != nil {
// handle error
}
// encode
hmd5HexHash:= hex.EncodeToString(p)
fmt.Println(md5HexHash) // prints md5HexHash
Note: If there's a builtin Terraform function we should close this based on that rather than implement it directly in the resource.
Community Note
Description
Google cloud has a facility to give md5 hash in hexadecimal format as well by using
-h
flag ingsutil
, see here. But this provider only provides the md5 hash (see here)which is obtained by converting this hexadecimal hash to binary and then doing base 64 encoding to it which is unusual. It would be helpful if this provider could simply leverage this built in feature provided by GCP.New or Affected Resource(s)
Potential Terraform Configuration