Skip to content

Commit 3db6fa4

Browse files
committed
Expose source_volume_name and source_volume_href on volume snapshot
1 parent b1638d3 commit 3db6fa4

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

cloudscale/resource_cloudscale_volume_snapshot.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,22 @@ func getVolumeSnapshotSchema(t SchemaType) map[string]*schema.Schema {
4141
Required: t.isResource(),
4242
Optional: t.isDataSource(),
4343
},
44+
"href": {
45+
Type: schema.TypeString,
46+
Computed: true,
47+
},
4448
"source_volume_uuid": {
4549
Type: schema.TypeString,
4650
Required: t.isResource(),
4751
ForceNew: t.isResource(),
4852
Optional: t.isDataSource(),
4953
Computed: t.isDataSource(),
5054
},
51-
"href": {
55+
"source_volume_name": {
56+
Type: schema.TypeString,
57+
Computed: true,
58+
},
59+
"source_volume_href": {
5260
Type: schema.TypeString,
5361
Computed: true,
5462
},
@@ -148,6 +156,8 @@ func gatherVolumeSnapshotResourceData(snap *cloudscale.VolumeSnapshot) ResourceD
148156
m["href"] = snap.HREF
149157
m["name"] = snap.Name
150158
m["source_volume_uuid"] = snap.SourceVolume.UUID
159+
m["source_volume_name"] = snap.SourceVolume.Name
160+
m["source_volume_href"] = snap.SourceVolume.HREF
151161
m["size_gb"] = snap.SizeGB
152162
m["status"] = snap.Status
153163
m["tags"] = snap.Tags

docs/data-sources/volume_snapshot.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ In addition to the arguments listed above, the following computed attributes are
2929

3030
* `href` - The cloudscale.ch API URL of the current resource.
3131
* `source_volume_uuid` - The UUID of the source volume.
32+
* `source_volume_name` - The name of the source volume.
33+
* `source_volume_href` - The cloudscale.ch API URL of the source volume.
3234
* `size_gb` - The size of the snapshot in GB.
3335
* `status` - The current status of the volume snapshot.

docs/resources/volume_snapshot.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ In addition to the arguments listed above, the following computed attributes are
7575
* `href` - The cloudscale.ch API URL of the current resource.
7676
* `size_gb` - The size of the snapshot in GB.
7777
* `status` - The current status of the volume snapshot (e.g. `available`).
78+
* `source_volume_name` - The name of the source volume.
79+
* `source_volume_href` - The cloudscale.ch API URL of the source volume.
7880

7981
## Import
8082

0 commit comments

Comments
 (0)