4.6.2
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||
)
|
||||
|
||||
func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute) error {
|
||||
func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute, pciList *compute.ListPCIDevices) error {
|
||||
log.Debugf("flattenCompute: ID %d, RG ID %d", computeRec.ID, computeRec.RGID)
|
||||
|
||||
customFields, _ := json.Marshal(computeRec.CustomFields)
|
||||
@@ -94,9 +94,20 @@ func flattenCompute(d *schema.ResourceData, computeRec *compute.RecordCompute) e
|
||||
d.Set("vgpus", computeRec.VGPUs)
|
||||
d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
return nil
|
||||
}
|
||||
|
||||
func flattenPCI(pciList compute.ListPCIDevices) []uint64 {
|
||||
res := make([]uint64, 0, len(pciList.Data))
|
||||
|
||||
for _, v := range pciList.Data {
|
||||
res = append(res, v.ID)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenTags(tags map[string]interface{}) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(tags))
|
||||
|
||||
@@ -559,7 +570,7 @@ func flattenNodes(m []interface{}) []string {
|
||||
return output
|
||||
}
|
||||
|
||||
func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute) error {
|
||||
func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute, pciList *compute.ListPCIDevices) error {
|
||||
// This function expects that compFacts string contains response from API compute/get,
|
||||
// i.e. detailed information about compute instance.
|
||||
//
|
||||
@@ -641,6 +652,7 @@ func flattenDataCompute(d *schema.ResourceData, compFacts *compute.RecordCompute
|
||||
d.Set("vgpus", compFacts.VGPUs)
|
||||
d.Set("virtual_image_id", compFacts.VirtualImageID)
|
||||
d.Set("virtual_image_name", compFacts.VirtualImageName)
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
//extra fields setting
|
||||
bootDisk := findBootDisk(compFacts.Disks)
|
||||
if bootDisk != nil {
|
||||
|
||||
Reference in New Issue
Block a user