Review by @paddyforan: corrected documentation. Replaced disk by source_disk. Deleted sourcedisk_id
This commit is contained in:
parent
6e76b907c7
commit
5fcc6593cd
|
@ -53,17 +53,7 @@ func resourceComputeSnapshot() *schema.Resource {
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"source_disk_id": &schema.Schema{
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
"source_disk": &schema.Schema{
|
"source_disk": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
"disk": &schema.Schema{
|
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
|
@ -96,7 +86,7 @@ func resourceComputeSnapshotCreate(d *schema.ResourceData, meta interface{}) err
|
||||||
Name: d.Get("name").(string),
|
Name: d.Get("name").(string),
|
||||||
}
|
}
|
||||||
|
|
||||||
disk := d.Get("disk").(string)
|
source_disk := d.Get("source_disk").(string)
|
||||||
|
|
||||||
if v, ok := d.GetOk("snapshot_encryption_key_raw"); ok {
|
if v, ok := d.GetOk("snapshot_encryption_key_raw"); ok {
|
||||||
snapshot.SnapshotEncryptionKey = &compute.CustomerEncryptionKey{}
|
snapshot.SnapshotEncryptionKey = &compute.CustomerEncryptionKey{}
|
||||||
|
@ -109,7 +99,7 @@ func resourceComputeSnapshotCreate(d *schema.ResourceData, meta interface{}) err
|
||||||
}
|
}
|
||||||
|
|
||||||
op, err := config.clientCompute.Disks.CreateSnapshot(
|
op, err := config.clientCompute.Disks.CreateSnapshot(
|
||||||
project, d.Get("zone").(string), disk, snapshot).Do()
|
project, d.Get("zone").(string), source_disk, snapshot).Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error creating snapshot: %s", err)
|
return fmt.Errorf("Error creating snapshot: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -156,8 +146,6 @@ func resourceComputeSnapshotRead(d *schema.ResourceData, meta interface{}) error
|
||||||
d.Set("source_disk_encryption_key_sha256", snapshot.SourceDiskEncryptionKey.Sha256)
|
d.Set("source_disk_encryption_key_sha256", snapshot.SourceDiskEncryptionKey.Sha256)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("source_disk_id", snapshot.SourceDiskId)
|
|
||||||
|
|
||||||
d.Set("source_disk", snapshot.SourceDisk)
|
d.Set("source_disk", snapshot.SourceDisk)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -15,7 +15,7 @@ Creates a new snapshot of a disk within GCE.
|
||||||
```js
|
```js
|
||||||
resource "google_compute_snapshot" "default" {
|
resource "google_compute_snapshot" "default" {
|
||||||
name = "test-snapshot"
|
name = "test-snapshot"
|
||||||
disk = "test-disk"
|
source_disk = "test-disk"
|
||||||
zone = "us-central1-a"
|
zone = "us-central1-a"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -29,11 +29,11 @@ The following arguments are supported:
|
||||||
|
|
||||||
* `zone` - (Required) The zone where the source disk is located.
|
* `zone` - (Required) The zone where the source disk is located.
|
||||||
|
|
||||||
* `disk` - (Required) The disk which will be used as the source of the snapshot
|
* `source_disk` - (Required) The disk which will be used as the source of the snapshot
|
||||||
|
|
||||||
- - -
|
- - -
|
||||||
|
|
||||||
* `sourcedisk_encryption_key_raw` - (Optional) A 256-bit [customer-supplied encryption key]
|
* `source_disk_encryption_key_raw` - (Optional) A 256-bit [customer-supplied encryption key]
|
||||||
(https://cloud.google.com/compute/docs/disks/customer-supplied-encryption),
|
(https://cloud.google.com/compute/docs/disks/customer-supplied-encryption),
|
||||||
encoded in [RFC 4648 base64](https://tools.ietf.org/html/rfc4648#section-4)
|
encoded in [RFC 4648 base64](https://tools.ietf.org/html/rfc4648#section-4)
|
||||||
to decrypt the source disk.
|
to decrypt the source disk.
|
||||||
|
@ -56,15 +56,9 @@ exported:
|
||||||
[customer-supplied encryption key](https://cloud.google.com/compute/docs/disks/customer-supplied-encryption)
|
[customer-supplied encryption key](https://cloud.google.com/compute/docs/disks/customer-supplied-encryption)
|
||||||
that protects this resource.
|
that protects this resource.
|
||||||
|
|
||||||
* `sourcedisk_encryption_key_sha256` - The [RFC 4648 base64]
|
* `source_disk_encryption_key_sha256` - The [RFC 4648 base64]
|
||||||
(https://tools.ietf.org/html/rfc4648#section-4) encoded SHA-256 hash of the
|
(https://tools.ietf.org/html/rfc4648#section-4) encoded SHA-256 hash of the
|
||||||
[customer-supplied encryption key](https://cloud.google.com/compute/docs/disks/customer-supplied-encryption)
|
[customer-supplied encryption key](https://cloud.google.com/compute/docs/disks/customer-supplied-encryption)
|
||||||
that protects the source disk.
|
that protects the source disk.
|
||||||
|
|
||||||
* `sourcedisk_id` - The ID value of the source disk used to create this snapshot.
|
|
||||||
This value may be used to determine whether the snapshot was taken from the
|
|
||||||
current or a previous instance of a given disk name.
|
|
||||||
|
|
||||||
* `sourcedisk` - The source disk used to create this snapshot.
|
|
||||||
|
|
||||||
* `self_link` - The URI of the created resource.
|
* `self_link` - The URI of the created resource.
|
||||||
|
|
Loading…
Reference in New Issue