max johnson
max johnson

Reputation: 153

Get a signed URL of google storage object via Terraform

I am trying to get an object (ex. abc.png) signed URL from google bucket via a Terraform .tf script. But I am not getting any output on the console.

I have installed terraform on my local Linux machine, I am providing service account JSON key as credentials but not getting the signed URL, please check my script below:

provider "google" {
  credentials = "account.json"
}

data "google_storage_object_signed_url" "get_url" {
  bucket       = "my bucket"
  path         = "new.json"
  content_md5  = "pRviqwS4c4OTJRTe03FD1w=="
  content_type = "text/plain"
  duration     = "2h"
  credentials  = "account.json"

  extension_headers = {
    x-goog-if-generation-match = 1
  }
}

Please let me know what I am doing wrong.

Upvotes: 1

Views: 578

Answers (1)

BMW
BMW

Reputation: 45333

If you need see Output Values, please add the Outputs code as below

output "signed_url" {
  value = "${data.google_storage_object_signed_url.get_url.signed_url}"
}

Upvotes: 1

Related Questions