mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-09 03:28:29 +00:00
Minor cleanup of disk's labelFingerprint. (#1651)
This commit is contained in:
parent
8591ab1577
commit
43cccf3e2c
|
@ -371,6 +371,10 @@ func resourceComputeDisk() *schema.Resource {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"label_fingerprint": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"last_attach_timestamp": {
|
"last_attach_timestamp": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
@ -408,11 +412,6 @@ func resourceComputeDisk() *schema.Resource {
|
||||||
Computed: true,
|
Computed: true,
|
||||||
Deprecated: "Use disk_encryption_key.sha256 instead.",
|
Deprecated: "Use disk_encryption_key.sha256 instead.",
|
||||||
},
|
},
|
||||||
|
|
||||||
"label_fingerprint": &schema.Schema{
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"project": {
|
"project": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -560,6 +559,9 @@ func resourceComputeDiskRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := d.Set("label_fingerprint", flattenComputeDiskLabelFingerprint(res["labelFingerprint"])); err != nil {
|
||||||
|
return fmt.Errorf("Error reading Disk: %s", err)
|
||||||
|
}
|
||||||
if err := d.Set("creation_timestamp", flattenComputeDiskCreationTimestamp(res["creationTimestamp"])); err != nil {
|
if err := d.Set("creation_timestamp", flattenComputeDiskCreationTimestamp(res["creationTimestamp"])); err != nil {
|
||||||
return fmt.Errorf("Error reading Disk: %s", err)
|
return fmt.Errorf("Error reading Disk: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -636,15 +638,17 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
d.Partial(true)
|
d.Partial(true)
|
||||||
|
|
||||||
if d.HasChange("labels") {
|
if d.HasChange("label_fingerprint") || d.HasChange("labels") {
|
||||||
|
labelFingerprintProp := d.Get("label_fingerprint")
|
||||||
labelsProp, err := expandComputeDiskLabels(d.Get("labels"), d, config)
|
labelsProp, err := expandComputeDiskLabels(d.Get("labels"), d, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = map[string]interface{}{
|
obj = map[string]interface{}{
|
||||||
|
"labelFingerprint": labelFingerprintProp,
|
||||||
"labels": labelsProp,
|
"labels": labelsProp,
|
||||||
"labelFingerprint": d.Get("label_fingerprint").(string)}
|
}
|
||||||
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/zones/{{zone}}/disks/{{name}}/setLabels")
|
url, err = replaceVars(d, config, "https://www.googleapis.com/compute/v1/projects/{{project}}/zones/{{zone}}/disks/{{name}}/setLabels")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -667,6 +671,7 @@ func resourceComputeDiskUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.SetPartial("label_fingerprint")
|
||||||
d.SetPartial("labels")
|
d.SetPartial("labels")
|
||||||
}
|
}
|
||||||
if d.HasChange("size") {
|
if d.HasChange("size") {
|
||||||
|
@ -834,6 +839,10 @@ func resourceComputeDiskImport(d *schema.ResourceData, meta interface{}) ([]*sch
|
||||||
return []*schema.ResourceData{d}, nil
|
return []*schema.ResourceData{d}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func flattenComputeDiskLabelFingerprint(v interface{}) interface{} {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
func flattenComputeDiskCreationTimestamp(v interface{}) interface{} {
|
func flattenComputeDiskCreationTimestamp(v interface{}) interface{} {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
@ -1140,7 +1149,5 @@ func resourceComputeDiskDecoder(d *schema.ResourceData, meta interface{}, res ma
|
||||||
res["sourceSnapshotEncryptionKey"] = transformed
|
res["sourceSnapshotEncryptionKey"] = transformed
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("label_fingerprint", res["labelFingerprint"])
|
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,9 @@ The `source_snapshot_encryption_key` block supports:
|
||||||
|
|
||||||
In addition to the arguments listed above, the following computed attributes are exported:
|
In addition to the arguments listed above, the following computed attributes are exported:
|
||||||
|
|
||||||
|
* `label_fingerprint` -
|
||||||
|
The fingerprint used for optimistic locking of this resource. Used
|
||||||
|
internally during updates.
|
||||||
* `creation_timestamp` -
|
* `creation_timestamp` -
|
||||||
Creation timestamp in RFC3339 text format.
|
Creation timestamp in RFC3339 text format.
|
||||||
* `last_attach_timestamp` -
|
* `last_attach_timestamp` -
|
||||||
|
@ -216,8 +219,6 @@ In addition to the arguments listed above, the following computed attributes are
|
||||||
`disk_encryption_key.sha256`. It is deprecated to enhance
|
`disk_encryption_key.sha256`. It is deprecated to enhance
|
||||||
consistency with `source_image_encryption_key` and
|
consistency with `source_image_encryption_key` and
|
||||||
`source_snapshot_encryption_key`.
|
`source_snapshot_encryption_key`.
|
||||||
* `label_fingerprint`: The fingerprint of the assigned labels. Provided
|
|
||||||
when labels are updated to prevent contention (first-write-wins).
|
|
||||||
## Timeouts
|
## Timeouts
|
||||||
|
|
||||||
This resource provides the following
|
This resource provides the following
|
||||||
|
|
Loading…
Reference in New Issue
Block a user