Skip to content

Commit

Permalink
Add google_storage_bucket_object.media_link (#3803)
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Gudger <ian@iangudger.com>
  • Loading branch information
danawillow and iangudger authored Aug 4, 2020
1 parent 1f446ba commit 34b5c66
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func dataSourceGoogleStorageBucketObjectRead(d *schema.ResourceData, meta interf
d.Set("self_link", res["selfLink"])
d.Set("storage_class", res["storageClass"])
d.Set("md5hash", res["md5Hash"])
d.Set("media_link", res["mediaLink"])
d.Set("metadata", res["metadata"])

d.SetId(bucket + "-" + name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ func resourceStorageBucketObject() *schema.Resource {
Computed: true,
Description: `The name of the object. Use this field in interpolations with google_storage_object_acl to recreate google_storage_object_acl resources when your google_storage_bucket_object is recreated.`,
},

"media_link": {
Type: schema.TypeString,
Computed: true,
Description: `A url reference to download this object.`,
},
},
}
}
Expand Down Expand Up @@ -269,6 +275,7 @@ func resourceStorageBucketObjectRead(d *schema.ResourceData, meta interface{}) e
d.Set("self_link", res.SelfLink)
d.Set("output_name", res.Name)
d.Set("metadata", res.Metadata)
d.Set("media_link", res.MediaLink)

d.SetId(objectGetId(res))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ The following attributes are exported:
* `storage_class` - (Computed) The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object.
Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`. If not provided, this defaults to the bucket's default
storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class.

* `media_link` - (Computed) A url reference to download this object.
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ exported:

* `output_name` - (Computed) The name of the object. Use this field in interpolations with `google_storage_object_acl` to recreate
`google_storage_object_acl` resources when your `google_storage_bucket_object` is recreated.

* `media_link` - (Computed) A url reference to download this object.

0 comments on commit 34b5c66

Please sign in to comment.