google_storage_object_signed_url

The Google Cloud storage signed URL data source generates a signed URL for a given storage object. Signed URLs provide a way to give time-limited read or write access to anyone in possession of the URL, regardless of whether they have a Google account.

For more info about signed URL's is available here.

Example Usage

data "google_storage_object_signed_url" "artifact" {
  bucket = "install_binaries"
  path   = "path/to/install_file.bin"
}

resource "google_compute_instance" "vm" {
  name = "vm"

  provisioner "remote-exec" {
    inline = [
      "wget '${data.google_storage_object_signed_url.artifact.signed_url}' -O install_file.bin",
      "chmod +x install_file.bin",
      "./install_file.bin",
    ]
  }
}

Full Example

data "google_storage_object_signed_url" "get_url" {
  bucket       = "fried_chicken"
  path         = "path/to/file"
  content_md5  = "pRviqwS4c4OTJRTe03FD1w=="
  content_type = "text/plain"
  duration     = "2d"
  credentials  = file("path/to/credentials.json")

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

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported: