Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add google_storage_bucket_object.media_link #2331

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3803.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
storage: added output-only `media_link` to `google_storage_bucket_object`
```
1 change: 1 addition & 0 deletions google-beta/data_source_google_storage_bucket_object.go
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
7 changes: 7 additions & 0 deletions google-beta/resource_storage_bucket_object.go
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
2 changes: 2 additions & 0 deletions website/docs/d/storage_bucket_object.html.markdown
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.
2 changes: 2 additions & 0 deletions website/docs/r/storage_bucket_object.html.markdown
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.