4.11.0
This commit is contained in:
@@ -41,7 +41,6 @@ import (
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
)
|
||||
|
||||
// TODO: resources (additional ds / additional request inside body (?))
|
||||
func dataSourceAccountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
acc, err := utilityAccountCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
@@ -119,10 +118,6 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
@@ -171,91 +166,6 @@ func sepsSchemaMake() map[string]*schema.Schema {
|
||||
return res
|
||||
}
|
||||
|
||||
func resourcesSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"current": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"cpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"disksize": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"extips": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"seps": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: sepsSchemaMake(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"reserved": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"cpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"disksize": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"extips": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"ram": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"seps": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: sepsSchemaMake(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func computesSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"started": {
|
||||
|
||||
@@ -55,7 +55,6 @@ func dataSourceAccountConsumedUnitsRead(ctx context.Context, d *schema.ResourceD
|
||||
d.Set("cu_dm", accountConsumedUnits.CUDM)
|
||||
d.Set("cu_i", accountConsumedUnits.CUI)
|
||||
d.Set("cu_m", accountConsumedUnits.CUM)
|
||||
d.Set("cu_np", accountConsumedUnits.CUNP)
|
||||
d.Set("gpu_units", accountConsumedUnits.GPUUnits)
|
||||
|
||||
return nil
|
||||
@@ -88,10 +87,6 @@ func dataSourceAccountConsumedUnitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -108,10 +108,6 @@ func dataSourceResourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -55,7 +55,6 @@ func dataSourceAccountReservedUnitsRead(ctx context.Context, d *schema.ResourceD
|
||||
d.Set("cu_dm", accountReservedUnits.CUDM)
|
||||
d.Set("cu_i", accountReservedUnits.CUI)
|
||||
d.Set("cu_m", accountReservedUnits.CUM)
|
||||
d.Set("cu_np", accountReservedUnits.CUNP)
|
||||
d.Set("gpu_units", accountReservedUnits.GPUUnits)
|
||||
|
||||
return nil
|
||||
@@ -88,10 +87,6 @@ func dataSourceAccountReservedUnitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -131,10 +131,6 @@ func dataSourceAccResourceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"ext_traffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -80,12 +80,11 @@ func flattenAccRGComputes(argc account.RGComputes) []map[string]interface{} {
|
||||
func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"cpu": r.CPU,
|
||||
"disksize": r.DiskSize,
|
||||
"extips": r.ExtIPs,
|
||||
"exttraffic": r.ExtTraffic,
|
||||
"gpu": r.GPU,
|
||||
"ram": r.RAM,
|
||||
"cpu": r.CPU,
|
||||
"disksize": r.DiskSize,
|
||||
"extips": r.ExtIPs,
|
||||
"gpu": r.GPU,
|
||||
"ram": r.RAM,
|
||||
//"seps": flattenAccountSeps(r.SEPs),
|
||||
}
|
||||
res = append(res, temp)
|
||||
@@ -95,12 +94,11 @@ func flattenAccResourceHack(r account.LimitsRG) []map[string]interface{} {
|
||||
func flattenAccResourceRg(r account.Resource) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"cpu": r.CPU,
|
||||
"disksize": r.DiskSize,
|
||||
"extips": r.ExtIPs,
|
||||
"exttraffic": r.ExtTraffic,
|
||||
"gpu": r.GPU,
|
||||
"ram": r.RAM,
|
||||
"cpu": r.CPU,
|
||||
"disksize": r.DiskSize,
|
||||
"extips": r.ExtIPs,
|
||||
"gpu": r.GPU,
|
||||
"ram": r.RAM,
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
@@ -223,10 +221,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -256,10 +250,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -288,10 +278,6 @@ func dataSourceAccountRGListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
func flattenAccount(d *schema.ResourceData, acc account.RecordAccount) error {
|
||||
d.Set("dc_location", acc.DCLocation)
|
||||
d.Set("desc", acc.Description)
|
||||
//TODO
|
||||
// d.Set("resources", flattenAccResources(acc.Resources))
|
||||
d.Set("acl", flattenAccAcl(acc.ACL))
|
||||
d.Set("company", acc.Company)
|
||||
d.Set("companyurl", acc.CompanyURL)
|
||||
@@ -52,8 +50,6 @@ func flattenAccount(d *schema.ResourceData, acc account.RecordAccount) error {
|
||||
func flattenAccountResource(d *schema.ResourceData, acc account.RecordAccount) error {
|
||||
d.Set("dc_location", acc.DCLocation)
|
||||
d.Set("desc", acc.Description)
|
||||
//TODO
|
||||
// d.Set("resources", flattenAccResources(acc.Resources))
|
||||
d.Set("acl", flattenAccAcl(acc.ACL))
|
||||
d.Set("company", acc.Company)
|
||||
d.Set("companyurl", acc.CompanyURL)
|
||||
@@ -144,7 +140,6 @@ func flattenAccResourceLimits(rl account.ResourceLimits) []map[string]interface{
|
||||
"cu_dm": rl.CUDM,
|
||||
"cu_i": rl.CUI,
|
||||
"cu_m": rl.CUM,
|
||||
"cu_np": rl.CUNP,
|
||||
"gpu_units": rl.GPUUnits,
|
||||
"storage_policy": flattenSTPolicy(rl.StoragePolicy),
|
||||
}
|
||||
@@ -165,16 +160,6 @@ func flattenSTPolicy(ast []account.StoragePolicyItem) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
// func flattenAccResources(r account.Resources) []map[string]interface{} {
|
||||
// res := make([]map[string]interface{}, 0)
|
||||
// temp := map[string]interface{}{
|
||||
// "current": flattenAccResource(r.Current),
|
||||
// "reserved": flattenAccResource(r.Reserved),
|
||||
// }
|
||||
// res = append(res, temp)
|
||||
// return res
|
||||
// }
|
||||
|
||||
func flattenAccountSeps(seps map[string]map[string]account.DiskUsage) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for sepKey, sepVal := range seps {
|
||||
@@ -198,7 +183,6 @@ func flattenAccResource(r account.Resource) []map[string]interface{} {
|
||||
"disk_size": r.DiskSize,
|
||||
"disk_size_max": r.DiskSizeMax,
|
||||
"ext_ips": r.ExtIPs,
|
||||
"ext_traffic": r.ExtTraffic,
|
||||
"gpu": r.GPU,
|
||||
"ram": r.RAM,
|
||||
"seps": flattenAccountSeps(r.SEPs),
|
||||
|
||||
@@ -297,15 +297,6 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
updated = true
|
||||
}
|
||||
if resLimitConv["cu_np"] != nil {
|
||||
maxNP := int(resLimitConv["cu_np"].(float64))
|
||||
if maxNP == 0 {
|
||||
req.MaxNetworkPeerTransfer = -1
|
||||
} else {
|
||||
req.MaxNetworkPeerTransfer = int64(maxNP)
|
||||
}
|
||||
updated = true
|
||||
}
|
||||
if resLimitConv["gpu_units"] != nil {
|
||||
gpuUnits := int(resLimitConv["gpu_units"].(float64))
|
||||
if gpuUnits == 0 {
|
||||
@@ -548,11 +539,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Optional: true,
|
||||
@@ -585,13 +571,6 @@ func resourceAccountSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
// "resources": {
|
||||
// Type: schema.TypeList,
|
||||
// Computed: true,
|
||||
// Elem: &schema.Resource{
|
||||
// Schema: resourcesSchemaMake(),
|
||||
// },
|
||||
// },
|
||||
"acl": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
|
||||
@@ -52,7 +52,7 @@ func utilityAuditCheckPresence(ctx context.Context, d *schema.ResourceData, m in
|
||||
req.AuditGuid = d.Get("audit_guid").(string)
|
||||
}
|
||||
|
||||
log.Debugf("utilityStackCheckPresence: load audit")
|
||||
log.Debugf("utilityAuditCheckPresence: load audit")
|
||||
auditInfo, err := c.CloudAPI().Audit().Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -110,7 +110,7 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -101,7 +101,7 @@ func flattenBasicServiceComputes(bscs bservice.ListComputes) []map[string]interf
|
||||
"id": bsc.ID,
|
||||
"name": bsc.Name,
|
||||
"rg_id": bsc.RGID,
|
||||
"stack_id": bsc.StackID,
|
||||
"node_id": bsc.NodeID,
|
||||
"status": bsc.Status,
|
||||
"tech_status": bsc.TechStatus,
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -58,7 +58,6 @@ func resourceBasicServiceGroupCreate(ctx context.Context, d *schema.ResourceData
|
||||
RAM: uint64(d.Get("ram").(int)),
|
||||
Disk: uint64(d.Get("disk").(int)),
|
||||
ImageID: uint64(d.Get("image_id").(int)),
|
||||
Driver: d.Get("driver").(string),
|
||||
StoragePolicyID: uint64(d.Get("storage_policy_id").(int)),
|
||||
}
|
||||
|
||||
@@ -424,13 +423,8 @@ func resourceBasicServiceGroupSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"i440fx", "Q35"}, false),
|
||||
Default: "i440fx",
|
||||
},
|
||||
"driver": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "compute driver like a KVM_X86, etc.",
|
||||
Default: "KVM_X86",
|
||||
Default: "Q35",
|
||||
Description: "Chipset for virtual machines.",
|
||||
},
|
||||
///
|
||||
"role": {
|
||||
@@ -579,6 +573,10 @@ func resourceBasicServiceGroupSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"driver": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -80,6 +80,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
// "boot_partition": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
@@ -382,6 +386,10 @@ func dataSourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -147,6 +147,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
// "boot_partition": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
@@ -456,6 +460,10 @@ func dataSourceDiskListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -138,11 +138,6 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"_ckey": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "CKey",
|
||||
},
|
||||
"_meta": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -165,6 +160,10 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_partition": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -391,6 +390,11 @@ func dataSourceDiskListUnattachedSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "shareable",
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Cache mode for the disk",
|
||||
},
|
||||
"size_max": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -128,6 +128,10 @@ func dataSourceDiskDeletedListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
// "boot_partition": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
@@ -437,6 +441,10 @@ func dataSourceDiskDeletedListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"size_available": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -21,11 +21,11 @@ func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]inter
|
||||
for _, unattachedDisk := range ul.Data {
|
||||
unattachedDiskAcl, _ := json.Marshal(unattachedDisk.ACL)
|
||||
tmp := map[string]interface{}{
|
||||
"_ckey": unattachedDisk.CKey,
|
||||
"_meta": flattens.FlattenMeta(unattachedDisk.Meta),
|
||||
"account_id": unattachedDisk.AccountID,
|
||||
"account_name": unattachedDisk.AccountName,
|
||||
"acl": string(unattachedDiskAcl),
|
||||
"blk_discard": unattachedDisk.BLKDiscard,
|
||||
"boot_partition": unattachedDisk.BootPartition,
|
||||
"created_time": unattachedDisk.CreatedTime,
|
||||
"deleted_time": unattachedDisk.DeletedTime,
|
||||
@@ -57,6 +57,7 @@ func flattenDiskListUnattached(ul *disks.ListDisksUnattached) []map[string]inter
|
||||
"role": unattachedDisk.Role,
|
||||
"sep_id": unattachedDisk.SEPID,
|
||||
"shareable": unattachedDisk.Shareable,
|
||||
"cache": unattachedDisk.Cache,
|
||||
"size_max": unattachedDisk.SizeMax,
|
||||
"size_used": unattachedDisk.SizeUsed,
|
||||
"snapshots": flattenDiskSnapshotList(unattachedDisk.Snapshots),
|
||||
@@ -75,6 +76,7 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("account_id", disk.AccountID)
|
||||
d.Set("account_name", disk.AccountName)
|
||||
d.Set("acl", string(diskAcl))
|
||||
d.Set("blk_discard", disk.BLKDiscard)
|
||||
// d.Set("boot_partition", disk.BootPartition)
|
||||
d.Set("computes", flattenDiskComputes(disk.Computes))
|
||||
d.Set("created_by", disk.CreatedBy)
|
||||
@@ -95,7 +97,6 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
// d.Set("login", disk.Login)
|
||||
d.Set("machine_id", disk.MachineID)
|
||||
d.Set("machine_name", disk.MachineName)
|
||||
d.Set("milestones", disk.Milestones)
|
||||
d.Set("disk_name", disk.Name)
|
||||
d.Set("order", disk.Order)
|
||||
d.Set("params", disk.Params)
|
||||
@@ -114,10 +115,10 @@ func flattenDisk(d *schema.ResourceData, disk *disks.RecordDisk) {
|
||||
d.Set("role", disk.Role)
|
||||
d.Set("sep_id", disk.SepID)
|
||||
d.Set("sep_type", disk.SepType)
|
||||
d.Set("size_available", disk.SizeAvailable)
|
||||
d.Set("size_max", disk.SizeMax)
|
||||
d.Set("size_used", disk.SizeUsed)
|
||||
d.Set("shareable", disk.Shareable)
|
||||
d.Set("cache", disk.Cache)
|
||||
d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots))
|
||||
d.Set("status", disk.Status)
|
||||
d.Set("storage_policy_id", disk.StoragePolicyID)
|
||||
@@ -186,6 +187,7 @@ func flattenDiskReplica(d *schema.ResourceData, disk *disks.RecordDisk, statusRe
|
||||
d.Set("size_max", disk.SizeMax)
|
||||
d.Set("size_used", disk.SizeUsed)
|
||||
d.Set("shareable", disk.Shareable)
|
||||
d.Set("cache", disk.Cache)
|
||||
d.Set("snapshots", flattenDiskSnapshotList(disk.Snapshots))
|
||||
d.Set("status", disk.Status)
|
||||
d.Set("status_replication", statusReplication)
|
||||
@@ -219,6 +221,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||
"account_id": disk.AccountID,
|
||||
"account_name": disk.AccountName,
|
||||
"acl": string(diskAcl),
|
||||
"blk_discard": disk.BLKDiscard,
|
||||
"computes": flattenDiskComputes(disk.Computes),
|
||||
"created_by": disk.CreatedBy,
|
||||
"created_time": disk.CreatedTime,
|
||||
@@ -250,6 +253,7 @@ func flattenDiskList(dl *disks.ListDisks) []map[string]interface{} {
|
||||
"sep_id": disk.SepID,
|
||||
"sep_type": disk.SepType,
|
||||
"shareable": disk.Shareable,
|
||||
"cache": disk.Cache,
|
||||
"size_available": disk.SizeAvailable,
|
||||
"size_max": disk.SizeMax,
|
||||
"size_used": disk.SizeUsed,
|
||||
|
||||
@@ -533,6 +533,10 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
// "boot_partition": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
|
||||
@@ -133,7 +133,7 @@ func resourceDiskSnapshotUpdate(ctx context.Context, d *schema.ResourceData, m i
|
||||
TimeStamp: uint64(d.Get("timestamp").(int)),
|
||||
}
|
||||
|
||||
log.Debugf("resourceDiskUpdtae: Snapshot rollback with label", label)
|
||||
log.Debugf("resourceDiskUpdtae: Snapshot rollback with label %s", label)
|
||||
_, err := c.CloudAPI().Disks().SnapshotRollback(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
|
||||
@@ -145,14 +145,6 @@ func dataSourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -90,11 +90,6 @@ func dataSourceFlipgroupListSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "Filter by IP-address",
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by RG ID",
|
||||
},
|
||||
"sort_by": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
|
||||
@@ -61,8 +61,6 @@ func flattenFlipgroup(d *schema.ResourceData, fg *flipgroup.RecordFLIPGroup) {
|
||||
d.Set("net_id", fg.NetID)
|
||||
d.Set("net_type", fg.NetType)
|
||||
d.Set("network", fg.Network)
|
||||
d.Set("rg_id", fg.RGID)
|
||||
d.Set("rg_name", fg.RGName)
|
||||
d.Set("status", fg.Status)
|
||||
d.Set("updated_by", fg.UpdatedBy)
|
||||
d.Set("updated_time", fg.UpdatedTime)
|
||||
|
||||
@@ -265,14 +265,6 @@ func resourceFlipgroupSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -165,9 +165,6 @@ func utilityFlipgroupListCheckPresence(ctx context.Context, d *schema.ResourceDa
|
||||
if byIp, ok := d.GetOk("by_ip"); ok {
|
||||
req.ByIP = byIp.(string)
|
||||
}
|
||||
if rgId, ok := d.GetOk("rg_id"); ok {
|
||||
req.RGID = uint64(rgId.(int))
|
||||
}
|
||||
if byId, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(byId.(int))
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ func flattenImage(d *schema.ResourceData, img *image.RecordImage) {
|
||||
cdPresentedTo, _ := json.Marshal(img.CdPresentedTo)
|
||||
|
||||
d.Set("unc_path", img.UNCPath)
|
||||
d.Set("ckey", img.CKey)
|
||||
d.Set("account_id", img.AccountID)
|
||||
d.Set("acl", FlattenACL(img.ACL))
|
||||
d.Set("architecture", img.Architecture)
|
||||
|
||||
@@ -49,10 +49,6 @@ func dataSourceImageExtendSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"ckey": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"account_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -805,11 +805,13 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
||||
Description: "insert ssl certificate in x509 pem format",
|
||||
},
|
||||
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
|
||||
Default: "Q35",
|
||||
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
|
||||
},
|
||||
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
|
||||
@@ -715,11 +715,13 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
||||
),
|
||||
Description: "Node RAM in MB.",
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
|
||||
Default: "Q35",
|
||||
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
|
||||
},
|
||||
"disk": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
||||
@@ -290,11 +290,13 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Number of worker nodes to create.",
|
||||
},
|
||||
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"Q35", "i440fx"}, false),
|
||||
Default: "Q35",
|
||||
Description: "Type of the emulated system. Possible values: i440fx, Q35. Default: Q35",
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
Type: schema.TypeInt,
|
||||
|
||||
@@ -256,6 +256,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"boot_partition": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -264,6 +268,10 @@ func computeListDisksSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -1035,6 +1043,11 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"read_only": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Shows if compute is in read-only mode.",
|
||||
},
|
||||
"userdata": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -1128,14 +1141,6 @@ func dataSourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"virtual_image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"virtual_image_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"stateless_sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -76,6 +76,10 @@ func computeDisksSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"sep_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
@@ -226,10 +230,6 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"interfaces": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -409,6 +409,11 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"read_only": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Shows if compute is in read-only mode.",
|
||||
},
|
||||
"vgpus": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -420,10 +425,6 @@ func itemComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"virtual_image_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"loader_type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -128,7 +128,7 @@ func dataSourceComputePCIDeviceListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -50,6 +50,7 @@ func flattenDisks(disks []compute.InfoDisk) []map[string]interface{} {
|
||||
// "bus_number": disk.BusNumber,
|
||||
"disk_id": disk.ID,
|
||||
// "pci_slot": disk.PCISlot,
|
||||
"sep_id": disk.SepID,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
@@ -179,76 +180,73 @@ func flattenComputeList(computes *compute.ListComputes) []map[string]interface{}
|
||||
customFields, _ := json.Marshal(compute.CustomFields)
|
||||
devices, _ := json.Marshal(compute.Devices)
|
||||
temp := map[string]interface{}{
|
||||
"acl": flattenListACL(compute.ACL),
|
||||
"account_id": compute.AccountID,
|
||||
"account_name": compute.AccountName,
|
||||
"affinity_label": compute.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(compute.AffinityRules),
|
||||
"affinity_weight": compute.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(compute.AntiAffinityRules),
|
||||
"arch": compute.Architecture,
|
||||
"auto_start_w_node": compute.AutoStart,
|
||||
"boot_order": compute.BootOrder,
|
||||
"bootdisk_size": compute.BootDiskSize,
|
||||
"boot_image_id": compute.BootImageID,
|
||||
"chipset": compute.Chipset,
|
||||
"cd_image_id": compute.CdImageId,
|
||||
"clone_reference": compute.CloneReference,
|
||||
"clones": compute.Clones,
|
||||
"computeci_id": compute.ComputeCIID,
|
||||
"cpu_pin": compute.CPUPin,
|
||||
"cpus": compute.CPU,
|
||||
"created_by": compute.CreatedBy,
|
||||
"created_time": compute.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": compute.DeletedBy,
|
||||
"deleted_time": compute.DeletedTime,
|
||||
"desc": compute.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(compute.Disks),
|
||||
"driver": compute.Driver,
|
||||
"gid": compute.GID,
|
||||
"guid": compute.GUID,
|
||||
"hp_backed": compute.HPBacked,
|
||||
"compute_id": compute.ID,
|
||||
//TODO
|
||||
// "image_id": compute.ImageID,
|
||||
"interfaces": flattenInterfaces(compute.Interfaces),
|
||||
"live_migration_job_id": compute.LiveMigrationJobID,
|
||||
"lock_status": compute.LockStatus,
|
||||
"manager_id": compute.ManagerID,
|
||||
"manager_type": compute.ManagerType,
|
||||
"migrationjob": compute.MigrationJob,
|
||||
"milestones": compute.Milestones,
|
||||
"name": compute.Name,
|
||||
"need_reboot": compute.NeedReboot,
|
||||
"numa_affinity": compute.NumaAffinity,
|
||||
"numa_node_id": compute.NumaNodeId,
|
||||
"os_version": compute.OSVersion,
|
||||
"pinned": compute.PinnedToStack,
|
||||
"preferred_cpu": compute.PreferredCPU,
|
||||
"qemu_guest": flattenQemuQuest(compute.QemuQuest),
|
||||
"ram": compute.RAM,
|
||||
"reference_id": compute.ReferenceID,
|
||||
"registered": compute.Registered,
|
||||
"res_name": compute.ResName,
|
||||
"reserved_node_cpus": compute.ReservedNodeCpus,
|
||||
"rg_id": compute.RGID,
|
||||
"rg_name": compute.RGName,
|
||||
"snap_sets": flattenSnapSets(compute.SnapSets),
|
||||
"stateless_sep_id": compute.StatelessSepID,
|
||||
"stateless_sep_type": compute.StatelessSepType,
|
||||
"status": compute.Status,
|
||||
"tags": flattenTags(compute.Tags),
|
||||
"tech_status": compute.TechStatus,
|
||||
"total_disk_size": compute.TotalDiskSize,
|
||||
"updated_by": compute.UpdatedBy,
|
||||
"updated_time": compute.UpdatedTime,
|
||||
"user_managed": compute.UserManaged,
|
||||
"vgpus": compute.VGPUs,
|
||||
"vins_connected": compute.VINSConnected,
|
||||
//TODO
|
||||
// "virtual_image_id": compute.VirtualImageID,
|
||||
"acl": flattenListACL(compute.ACL),
|
||||
"account_id": compute.AccountID,
|
||||
"account_name": compute.AccountName,
|
||||
"affinity_label": compute.AffinityLabel,
|
||||
"affinity_rules": flattenListRules(compute.AffinityRules),
|
||||
"affinity_weight": compute.AffinityWeight,
|
||||
"anti_affinity_rules": flattenListRules(compute.AntiAffinityRules),
|
||||
"arch": compute.Architecture,
|
||||
"auto_start_w_node": compute.AutoStart,
|
||||
"boot_order": compute.BootOrder,
|
||||
"bootdisk_size": compute.BootDiskSize,
|
||||
"boot_image_id": compute.BootImageID,
|
||||
"chipset": compute.Chipset,
|
||||
"cd_image_id": compute.CdImageId,
|
||||
"clone_reference": compute.CloneReference,
|
||||
"clones": compute.Clones,
|
||||
"computeci_id": compute.ComputeCIID,
|
||||
"cpu_pin": compute.CPUPin,
|
||||
"cpus": compute.CPU,
|
||||
"created_by": compute.CreatedBy,
|
||||
"created_time": compute.CreatedTime,
|
||||
"custom_fields": string(customFields),
|
||||
"deleted_by": compute.DeletedBy,
|
||||
"deleted_time": compute.DeletedTime,
|
||||
"desc": compute.Description,
|
||||
"devices": string(devices),
|
||||
"disks": flattenDisks(compute.Disks),
|
||||
"driver": compute.Driver,
|
||||
"gid": compute.GID,
|
||||
"guid": compute.GUID,
|
||||
"hp_backed": compute.HPBacked,
|
||||
"compute_id": compute.ID,
|
||||
"interfaces": flattenInterfaces(compute.Interfaces),
|
||||
"live_migration_job_id": compute.LiveMigrationJobID,
|
||||
"lock_status": compute.LockStatus,
|
||||
"manager_id": compute.ManagerID,
|
||||
"manager_type": compute.ManagerType,
|
||||
"migrationjob": compute.MigrationJob,
|
||||
"milestones": compute.Milestones,
|
||||
"name": compute.Name,
|
||||
"need_reboot": compute.NeedReboot,
|
||||
"numa_affinity": compute.NumaAffinity,
|
||||
"numa_node_id": compute.NumaNodeId,
|
||||
"os_version": compute.OSVersion,
|
||||
"pinned": compute.PinnedToNode,
|
||||
"preferred_cpu": compute.PreferredCPU,
|
||||
"qemu_guest": flattenQemuQuest(compute.QemuQuest),
|
||||
"ram": compute.RAM,
|
||||
"reference_id": compute.ReferenceID,
|
||||
"registered": compute.Registered,
|
||||
"res_name": compute.ResName,
|
||||
"reserved_node_cpus": compute.ReservedNodeCpus,
|
||||
"rg_id": compute.RGID,
|
||||
"rg_name": compute.RGName,
|
||||
"snap_sets": flattenSnapSets(compute.SnapSets),
|
||||
"stateless_sep_id": compute.StatelessSepID,
|
||||
"stateless_sep_type": compute.StatelessSepType,
|
||||
"status": compute.Status,
|
||||
"tags": flattenTags(compute.Tags),
|
||||
"tech_status": compute.TechStatus,
|
||||
"total_disk_size": compute.TotalDiskSize,
|
||||
"updated_by": compute.UpdatedBy,
|
||||
"updated_time": compute.UpdatedTime,
|
||||
"user_managed": compute.UserManaged,
|
||||
"read_only": compute.ReadOnly,
|
||||
"vgpus": compute.VGPUs,
|
||||
"vins_connected": compute.VINSConnected,
|
||||
"loader_type": compute.LoaderType,
|
||||
"boot_type": compute.BootType,
|
||||
"hot_resize": compute.HotResize,
|
||||
@@ -279,6 +277,8 @@ func flattenBootDisk(bootDisk *compute.ItemComputeDisk) []map[string]interface{}
|
||||
"present_to": bootDisk.PresentTo,
|
||||
"storage_policy_id": bootDisk.StoragePolicyID,
|
||||
"to_clean": bootDisk.ToClean,
|
||||
"cache": bootDisk.Cache,
|
||||
"blk_discard": bootDisk.BLKDiscard,
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
@@ -333,6 +333,8 @@ func flattenComputeDisksDemo(disksList compute.ListComputeDisks, disksBlocks, ex
|
||||
"deleted_time": disk.DeletedTime,
|
||||
"updated_time": disk.UpdatedTime,
|
||||
"permanently": pernamentlyValue,
|
||||
"cache": disk.Cache,
|
||||
"blk_discard": disk.BLKDiscard,
|
||||
}
|
||||
res = append(res, temp)
|
||||
indexDataDisks++
|
||||
@@ -351,6 +353,7 @@ func flattenNetwork(networks []interface{}, interfaces compute.ListInterfaces) [
|
||||
"ip_address": network.IPAddress,
|
||||
"mac": network.MAC,
|
||||
"mtu": network.MTU,
|
||||
"net_mask": network.NetMask,
|
||||
"sdn_interface_id": network.SDNInterfaceID,
|
||||
"weight": flattenNetworkWeight(networks, network.NetID, network.NetType),
|
||||
"enabled": network.Enabled,
|
||||
@@ -428,12 +431,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
d.Set("gid", computeRec.GID)
|
||||
d.Set("guid", computeRec.GUID)
|
||||
d.Set("compute_id", computeRec.ID)
|
||||
//TODO
|
||||
// if computeRec.VirtualImageID != 0 {
|
||||
// d.Set("image_id", computeRec.VirtualImageID)
|
||||
// } else {
|
||||
// d.Set("image_id", computeRec.ImageID)
|
||||
// }
|
||||
d.Set("image_id", computeRec.ImageID)
|
||||
d.Set("interfaces", flattenInterfaces(computeRec.Interfaces))
|
||||
d.Set("lock_status", computeRec.LockStatus)
|
||||
d.Set("manager_id", computeRec.ManagerID)
|
||||
@@ -451,7 +449,7 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
if err := d.Set("os_users", parseOsUsers(computeRec.OSUsers)); err != nil {
|
||||
return err
|
||||
}
|
||||
d.Set("pinned", computeRec.PinnedToStack)
|
||||
d.Set("pinned", computeRec.PinnedToNode)
|
||||
d.Set("preferred_cpu", computeRec.PreferredCPU)
|
||||
d.Set("ram", computeRec.RAM)
|
||||
d.Set("reference_id", computeRec.ReferenceID)
|
||||
@@ -469,11 +467,9 @@ func flattenCompute(d *schema.ResourceData, computeRec compute.RecordCompute, pc
|
||||
d.Set("updated_by", computeRec.UpdatedBy)
|
||||
d.Set("updated_time", computeRec.UpdatedTime)
|
||||
d.Set("user_managed", computeRec.UserManaged)
|
||||
d.Set("read_only", computeRec.ReadOnly)
|
||||
d.Set("vnc_password", computeRec.VNCPassword)
|
||||
d.Set("vgpus", flattenVGPUs(computeRec.VGPUs))
|
||||
//TODO
|
||||
// d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
// d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
d.Set("loader_type", computeRec.LoaderType)
|
||||
d.Set("boot_type", computeRec.BootType)
|
||||
d.Set("hot_resize", computeRec.HotResize)
|
||||
@@ -585,9 +581,11 @@ func flattenListComputeDisks(disks compute.ListComputeDisks) []map[string]interf
|
||||
"_ckey": disk.CKey,
|
||||
"acl": string(acl),
|
||||
"account_id": disk.AccountID,
|
||||
"blk_discard": disk.BLKDiscard,
|
||||
"boot_partition": disk.BootPartition,
|
||||
"bus_number": disk.BusNumber,
|
||||
"created_time": disk.CreatedTime,
|
||||
"cache": disk.Cache,
|
||||
"created_by": disk.CreatedBy,
|
||||
"deleted_time": disk.DeletedTime,
|
||||
"deleted_by": disk.DeletedBy,
|
||||
@@ -722,7 +720,7 @@ func flattenDataCompute(d *schema.ResourceData, computeRec compute.RecordCompute
|
||||
d.Set("natable_vins_network", computeRec.NatableVINSNetwork)
|
||||
d.Set("natable_vins_network_name", computeRec.NatableVINSNetworkName)
|
||||
d.Set("os_users", flattenOsUsers(computeRec.OSUsers))
|
||||
d.Set("pinned", computeRec.PinnedToStack)
|
||||
d.Set("pinned", computeRec.PinnedToNode)
|
||||
d.Set("preferred_CPU", computeRec.PreferredCPU)
|
||||
d.Set("qemu_guest", flattenQemuQuest(computeRec.QemuQuest))
|
||||
d.Set("ram", computeRec.RAM)
|
||||
@@ -741,12 +739,10 @@ func flattenDataCompute(d *schema.ResourceData, computeRec compute.RecordCompute
|
||||
d.Set("updated_by", computeRec.UpdatedBy)
|
||||
d.Set("updated_time", computeRec.UpdatedTime)
|
||||
d.Set("user_managed", computeRec.UserManaged)
|
||||
d.Set("read_only", computeRec.ReadOnly)
|
||||
d.Set("userdata", string(userdata))
|
||||
d.Set("vnc_password", computeRec.VNCPassword)
|
||||
d.Set("vgpus", flattenVGPUs(computeRec.VGPUs))
|
||||
//TODO
|
||||
// d.Set("virtual_image_id", computeRec.VirtualImageID)
|
||||
// d.Set("virtual_image_name", computeRec.VirtualImageName)
|
||||
d.Set("pci_devices", flattenPCI(*pciList))
|
||||
d.Set("loader_type", computeRec.LoaderType)
|
||||
d.Set("boot_type", computeRec.BootType)
|
||||
@@ -884,7 +880,7 @@ func flattenPCIDevice(deviceList []compute.ItemPCIDevice) []map[string]interface
|
||||
"device_id": dev.ID,
|
||||
"name": dev.Name,
|
||||
"rg_id": dev.RGID,
|
||||
"stack_id": dev.StackID,
|
||||
"node_id": dev.NodeID,
|
||||
"status": dev.Status,
|
||||
"system_name": dev.SystemName,
|
||||
}
|
||||
|
||||
@@ -184,6 +184,13 @@ func networkSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "network enable flag",
|
||||
},
|
||||
|
||||
"net_mask": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "Subnet mask, used only for DPDK and VFNIC network types",
|
||||
},
|
||||
}
|
||||
return rets
|
||||
}
|
||||
|
||||
@@ -182,6 +182,12 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
reqInterface.MTU = uint64(netInterfaceVal["mtu"].(int))
|
||||
}
|
||||
|
||||
if reqInterface.NetType == "DPDK" || reqInterface.NetType == "VFNIC" {
|
||||
if netMask, netMaskSet := netInterfaceVal["net_mask"]; netMaskSet {
|
||||
reqInterface.NetMask = uint64(netMask.(int))
|
||||
}
|
||||
}
|
||||
|
||||
ipaddr, ipSet := netInterfaceVal["ip_address"]
|
||||
if ipSet {
|
||||
reqInterface.IPAddr = ipaddr.(string)
|
||||
@@ -460,16 +466,16 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.Get("pin_to_stack").(bool) {
|
||||
if d.Get("pin_to_node").(bool) {
|
||||
if !d.Get("started").(bool) {
|
||||
warnings.Add(errors.New("cannot pin to stack a VM, VM should be started"))
|
||||
warnings.Add(errors.New("cannot pin to node a VM, VM should be started"))
|
||||
}
|
||||
if d.Get("started").(bool) {
|
||||
req := compute.PinToStackRequest{
|
||||
req := compute.PinToNodeRequest{
|
||||
ComputeID: computeId,
|
||||
}
|
||||
req.AutoStart = d.Get("auto_start_w_node").(bool)
|
||||
_, err = c.CloudAPI().Compute().PinToStack(ctx, req)
|
||||
_, err = c.CloudAPI().Compute().PinToNode(ctx, req)
|
||||
if err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
@@ -637,7 +643,7 @@ func resourceComputeCreate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if !d.Get("pin_to_stack").(bool) && d.Get("auto_start_w_node").(bool) {
|
||||
if !d.Get("pin_to_node").(bool) && d.Get("auto_start_w_node").(bool) {
|
||||
req := compute.UpdateRequest{
|
||||
ComputeID: computeId,
|
||||
AutoStart: d.Get("auto_start_w_node").(bool),
|
||||
@@ -1775,6 +1781,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
req := compute.StopRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
@@ -1785,28 +1792,28 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChange("pin_to_stack") || d.HasChange("started") {
|
||||
newPin := d.Get("pin_to_stack")
|
||||
if !newPin.(bool) && d.HasChange("pin_to_stack") {
|
||||
req := compute.UnpinFromStackRequest{
|
||||
if d.HasChange("pin_to_node") || d.HasChange("started") {
|
||||
newPin := d.Get("pin_to_node")
|
||||
if !newPin.(bool) && d.HasChange("pin_to_node") {
|
||||
req := compute.UnpinFromNodeRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().Compute().UnpinFromStack(ctx, req)
|
||||
_, err := c.CloudAPI().Compute().UnpinFromNode(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
if newPin.(bool) {
|
||||
if !d.Get("started").(bool) {
|
||||
return diag.Errorf("Cannot pin to stack a VM, that is not started")
|
||||
return diag.Errorf("Cannot pin to node a VM, that is not started")
|
||||
}
|
||||
|
||||
req := compute.PinToStackRequest{
|
||||
req := compute.PinToNodeRequest{
|
||||
ComputeID: computeRec.ID,
|
||||
}
|
||||
req.AutoStart = d.Get("auto_start_w_node").(bool)
|
||||
_, err = c.CloudAPI().Compute().PinToStack(ctx, req)
|
||||
_, err = c.CloudAPI().Compute().PinToNode(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
@@ -1992,6 +1999,10 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"cache": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2012,6 +2023,10 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"blk_discard": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return rets
|
||||
}
|
||||
@@ -2199,7 +2214,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"value": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Required: true,
|
||||
Description: "value that must match the key to be taken into account when analyzing this rule",
|
||||
},
|
||||
},
|
||||
@@ -2235,7 +2250,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"value": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Required: true,
|
||||
Description: "value that must match the key to be taken into account when analyzing this rule",
|
||||
},
|
||||
},
|
||||
@@ -2345,7 +2360,7 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Schema: cdSubresourceSchemaMake(),
|
||||
},
|
||||
},
|
||||
"pin_to_stack": {
|
||||
"pin_to_node": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
@@ -2735,6 +2750,11 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"read_only": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Description: "Shows if compute is in read-only mode.",
|
||||
},
|
||||
"vnc_password": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2866,12 +2886,12 @@ func ResourceCompute() *schema.Resource {
|
||||
},
|
||||
|
||||
CustomizeDiff: func(ctx context.Context, diff *schema.ResourceDiff, i interface{}) error {
|
||||
if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_stack", "auto_start_w_node", "network", "affinity_rules", "anti_affinity_rules",
|
||||
if diff.HasChanges() || diff.HasChanges("chipset", "pin_to_node", "auto_start_w_node", "network", "affinity_rules", "anti_affinity_rules",
|
||||
"extra_disks", "tags", "port_forwarding", "user_access", "snapshot", "pci_devices", "preferred_cpu", "security_groups") {
|
||||
diff.SetNewComputed("updated_time")
|
||||
diff.SetNewComputed("updated_by")
|
||||
}
|
||||
if diff.HasChanges("pin_to_stack") {
|
||||
if diff.HasChanges("pin_to_node") {
|
||||
diff.SetNewComputed("pinned")
|
||||
}
|
||||
if diff.HasChanges("image_id") {
|
||||
|
||||
@@ -281,6 +281,12 @@ func utilityComputeNetworksConfigure(ctx context.Context, d *schema.ResourceData
|
||||
req.MTU = uint64(netData["mtu"].(int))
|
||||
}
|
||||
|
||||
if req.NetType == "DPDK" || req.NetType == "VFNIC" {
|
||||
if netMask, ok := netData["net_mask"].(int); ok && netMask > 0 {
|
||||
req.NetMask = uint64(netMask)
|
||||
}
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().Compute().NetAttach(ctx, req)
|
||||
if err != nil {
|
||||
log.Errorf("utilityComputeNetworksConfigure: failed to attach net ID %d of type %s to Compute ID %s: %s",
|
||||
|
||||
@@ -60,7 +60,8 @@ func lbResourceSchemaMake() map[string]*schema.Schema {
|
||||
}
|
||||
sch["start"] = &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Required: true,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
}
|
||||
sch["desc"] = &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
|
||||
@@ -82,7 +82,10 @@ func resourceLBCreate(ctx context.Context, d *schema.ResourceData, m interface{}
|
||||
RGID: uint64(d.Get("rg_id").(int)),
|
||||
ExtNetID: uint64(d.Get("extnet_id").(int)),
|
||||
VINSID: uint64(d.Get("vins_id").(int)),
|
||||
Start: d.Get("start").(bool),
|
||||
}
|
||||
|
||||
if start, ok := d.GetOk("start"); ok {
|
||||
req.Start = start.(bool)
|
||||
}
|
||||
|
||||
if desc, ok := d.GetOk("desc"); ok {
|
||||
|
||||
@@ -212,8 +212,6 @@ func resourceLBBackendServerUpdate(ctx context.Context, d *schema.ResourceData,
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
//TODO: перенести servers сюда
|
||||
|
||||
return resourceLBBackendServerRead(ctx, d, m)
|
||||
}
|
||||
|
||||
|
||||
@@ -114,10 +114,6 @@ func DataSourceResgroup() *schema.Resource {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
// },
|
||||
// "exttraffic": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
// },
|
||||
// "gpu": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
@@ -169,10 +165,6 @@ func DataSourceResgroup() *schema.Resource {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
// },
|
||||
// "exttraffic": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
// },
|
||||
// "gpu": {
|
||||
// Type: schema.TypeInt,
|
||||
// Computed: true,
|
||||
@@ -261,10 +253,6 @@ func resourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -138,10 +138,6 @@ func dataSourceRGResourceSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
@@ -183,10 +179,6 @@ func dataSourceResourceLimitsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -76,10 +76,6 @@ func dataSourceRgUsageSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -63,7 +63,6 @@ func flattenRGSeps(seps map[string]map[string]rg.DiskUsage) []map[string]interfa
|
||||
// "cpu": r.CPU,
|
||||
// "disksize": r.DiskSize,
|
||||
// "extips": r.ExtIPs,
|
||||
// "exttraffic": r.ExtTraffic,
|
||||
// "gpu": r.GPU,
|
||||
// "ram": r.RAM,
|
||||
// "seps": flattenRgSeps(r.SEPs),
|
||||
@@ -143,13 +142,12 @@ func flattenRgSeps(seps map[string]map[string]rg.DiskUsage) []map[string]interfa
|
||||
func flattenQuota(resource rg.ResourceLimits) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"cpu": resource.CUC,
|
||||
"ram": resource.CUM,
|
||||
"disk": resource.CUDM,
|
||||
"ext_ips": resource.CUI,
|
||||
"ext_traffic": resource.CUNP,
|
||||
"gpu_units": resource.GPUUnits,
|
||||
"cu_d": resource.CUD,
|
||||
"cpu": resource.CUC,
|
||||
"ram": resource.CUM,
|
||||
"disk": resource.CUDM,
|
||||
"ext_ips": resource.CUI,
|
||||
"gpu_units": resource.GPUUnits,
|
||||
"cu_d": resource.CUD,
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
@@ -164,7 +162,6 @@ func flattenResource(resource rg.Resource) []map[string]interface{} {
|
||||
"disk_size": resource.DiskSize,
|
||||
"disk_size_max": resource.DiskSizeMax,
|
||||
"extips": resource.ExtIPs,
|
||||
"exttraffic": resource.ExtTraffic,
|
||||
"gpu": resource.GPU,
|
||||
"ram": resource.RAM,
|
||||
"seps": flattenRGSeps(resource.SEPs),
|
||||
@@ -292,7 +289,6 @@ func flattenRgResourceLimits(rl rg.ResourceLimits) []map[string]interface{} {
|
||||
"cu_i": rl.CUI,
|
||||
"cu_m": rl.CUM,
|
||||
"cu_dm": rl.CUDM,
|
||||
"cu_np": rl.CUNP,
|
||||
"gpu_units": rl.GPUUnits,
|
||||
"storage_policy": flattenRgStoragePolicy(rl.StoragePolicies),
|
||||
}
|
||||
@@ -609,7 +605,6 @@ func flattenRgUsageResource(d *schema.ResourceData, usage rg.RecordResourceUsage
|
||||
d.Set("disk_size", usage.DiskSize)
|
||||
d.Set("disk_size_max", usage.DiskSizeMax)
|
||||
d.Set("extips", usage.ExtIPs)
|
||||
d.Set("exttraffic", usage.ExtraTraffic)
|
||||
d.Set("gpu", usage.GPU)
|
||||
d.Set("ram", usage.RAM)
|
||||
d.Set("seps", flattenRgSeps(usage.SEPs))
|
||||
|
||||
@@ -37,17 +37,15 @@ type ResourceLimits struct {
|
||||
CUD float64 `json:"CU_D"`
|
||||
CUI float64 `json:"CU_I"`
|
||||
CUM float64 `json:"CU_M"`
|
||||
CUNP float64 `json:"CU_NP"`
|
||||
GpuUnits float64 `json:"gpu_units"`
|
||||
}
|
||||
|
||||
type QuotaRecord struct { // this is how quota is reported by /api/.../rg/get
|
||||
Cpu int `json:"CU_C"` // CPU count in pcs
|
||||
Ram int `json:"CU_M"` // RAM volume in MB
|
||||
Disk int `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs int `json:"CU_I"` // Ext IPs count
|
||||
ExtTraffic int `json:"CU_NP"` // Ext network traffic
|
||||
GpuUnits int `json:"gpu_units"` // GPU count
|
||||
Cpu int `json:"CU_C"` // CPU count in pcs
|
||||
Ram int `json:"CU_M"` // RAM volume in MB
|
||||
Disk int `json:"CU_D"` // Disk capacity in GB
|
||||
ExtIPs int `json:"CU_I"` // Ext IPs count
|
||||
GpuUnits int `json:"gpu_units"` // GPU count
|
||||
}
|
||||
|
||||
// Main information about audit
|
||||
@@ -85,9 +83,6 @@ type Resource struct {
|
||||
// Number of External IPs
|
||||
ExtIPs int64 `json:"extips"`
|
||||
|
||||
// External traffic
|
||||
ExtTraffic int64 `json:"exttraffic"`
|
||||
|
||||
// Number of grafic cores
|
||||
GPU int64 `json:"gpu"`
|
||||
|
||||
|
||||
@@ -34,12 +34,11 @@ package rg
|
||||
|
||||
func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
|
||||
quota := QuotaRecord{
|
||||
Cpu: -1,
|
||||
Ram: -1,
|
||||
Disk: -1,
|
||||
ExtTraffic: -1,
|
||||
ExtIPs: -1,
|
||||
GpuUnits: -1,
|
||||
Cpu: -1,
|
||||
Ram: -1,
|
||||
Disk: -1,
|
||||
ExtIPs: -1,
|
||||
GpuUnits: -1,
|
||||
}
|
||||
if len(arg_list) != 0 {
|
||||
subres_data := arg_list[0].(map[string]interface{})
|
||||
@@ -56,10 +55,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
|
||||
quota.Ram = subres_data["ram"].(int) // RAM volume in MB
|
||||
}
|
||||
|
||||
if subres_data["ext_traffic"].(int) > 0 {
|
||||
quota.ExtTraffic = subres_data["ext_traffic"].(int)
|
||||
}
|
||||
|
||||
if subres_data["ext_ips"].(int) > 0 {
|
||||
quota.ExtIPs = subres_data["ext_ips"].(int)
|
||||
}
|
||||
@@ -77,7 +72,6 @@ func makeQuotaRecord(arg_list []interface{}) QuotaRecord {
|
||||
// quota_map["cpu"] = quota.Cpu
|
||||
// quota_map["ram"] = quota.Ram // NB: this is float64, unlike the rest of values
|
||||
// quota_map["disk"] = quota.Disk
|
||||
// quota_map["ext_traffic"] = quota.ExtTraffic
|
||||
// quota_map["ext_ips"] = quota.ExtIPs
|
||||
// quota_map["gpu_units"] = quota.GpuUnits
|
||||
|
||||
|
||||
@@ -127,14 +127,6 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
req.MaxNumPublicIP = maxNumPublicIP
|
||||
}
|
||||
}
|
||||
if quotaMap["ext_traffic"] != nil {
|
||||
maxNP := int64(quotaMap["ext_traffic"].(int))
|
||||
if maxNP == 0 {
|
||||
req.MaxNetworkPeerTransfer = -1
|
||||
} else {
|
||||
req.MaxNetworkPeerTransfer = maxNP
|
||||
}
|
||||
}
|
||||
}
|
||||
if defNetType, ok := d.GetOk("def_net_type"); ok {
|
||||
req.DefNet = defNetType.(string) // NOTE: in API default network type is set by "def_net" parameter
|
||||
@@ -640,12 +632,6 @@ func ResourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Limit on the total volume of virtual storage resources in this resource group, specified in GB.",
|
||||
},
|
||||
"ext_traffic": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "Limit on the total ingress network traffic for this resource group, specified in GB.",
|
||||
},
|
||||
"ext_ips": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
@@ -913,10 +899,6 @@ func ResourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"cu_np": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"gpu_units": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
|
||||
@@ -11,12 +11,11 @@ func resourceRGStateUpgradeV1(ctx context.Context, rawState map[string]interface
|
||||
quota, ok := rawState["quota"]
|
||||
if !ok || quota == nil {
|
||||
rawState["quota"] = QuotaRecord{
|
||||
Cpu: -1,
|
||||
Ram: -1,
|
||||
Disk: -1,
|
||||
ExtTraffic: -1,
|
||||
ExtIPs: -1,
|
||||
GpuUnits: -1,
|
||||
Cpu: -1,
|
||||
Ram: -1,
|
||||
Disk: -1,
|
||||
ExtIPs: -1,
|
||||
GpuUnits: -1,
|
||||
}
|
||||
return rawState, nil
|
||||
}
|
||||
|
||||
@@ -113,14 +113,6 @@ func utilityUpdateRG(ctx context.Context, d *schema.ResourceData, m interface{},
|
||||
req.MaxNumPublicIP = maxNumPublicIP
|
||||
}
|
||||
}
|
||||
if resLimitsConv["ext_traffic"] != nil {
|
||||
maxNP := int64(resLimitsConv["ext_traffic"].(int))
|
||||
if maxNP == 0 {
|
||||
req.MaxNetworkPeerTransfer = -1
|
||||
} else {
|
||||
req.MaxNetworkPeerTransfer = maxNP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func dataSourceStackRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
stack, err := utilityStackCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("") // ensure ID is empty in this case
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
d.SetId(strconv.Itoa(d.Get("stack_id").(int)))
|
||||
flattenStack(d, stack)
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceStackSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"stack_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"cpu_allocation_ratio": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"descr": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"drivers": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"mem_allocation_ratio": {
|
||||
Type: schema.TypeFloat,
|
||||
Computed: true,
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func DataSourceStack() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceStackRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceStackSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
)
|
||||
|
||||
func dataSourceStackListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
stackList, err := utilityStackListCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("")
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenStackList(stackList))
|
||||
d.Set("entry_count", stackList.EntryCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func dataSourceStackListSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by name",
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by type",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by status",
|
||||
},
|
||||
"sort_by": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "sort by one of supported fields, format +|-(field)",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page number",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page size",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"stack_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"type": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func DataSourceStackList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceStackListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceStackListSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package stack
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack"
|
||||
)
|
||||
|
||||
func flattenStackList(stackl *stack.ListStacks) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
for _, stack := range stackl.Data {
|
||||
temp := map[string]interface{}{
|
||||
"stack_id": stack.ID,
|
||||
"name": stack.Name,
|
||||
"status": stack.Status,
|
||||
"type": stack.Type,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
|
||||
}
|
||||
|
||||
func flattenStack(d *schema.ResourceData, details *stack.InfoStack) error {
|
||||
log.Debugf("flattenStack: decoded Stack name %q / ID %d",
|
||||
details.Name, details.ID)
|
||||
|
||||
d.Set("stack_id", details.ID)
|
||||
d.Set("cpu_allocation_ratio", details.CPUAllocationRatio)
|
||||
d.Set("name", details.Name)
|
||||
d.Set("descr", details.Descr)
|
||||
d.Set("mem_allocation_ratio", details.MemAllocationRatio)
|
||||
d.Set("status", details.Status)
|
||||
d.Set("type", details.Type)
|
||||
d.Set("drivers", details.Drivers)
|
||||
return nil
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityStackCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*stack.InfoStack, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := stack.GetRequest{}
|
||||
|
||||
if d.Id() != "" {
|
||||
stackId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
req.StackId = stackId
|
||||
} else {
|
||||
req.StackId = uint64(d.Get("stack_id").(int))
|
||||
}
|
||||
|
||||
stackData, err := c.CloudAPI().Stack().Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stackData, nil
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityStackListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*stack.ListStacks, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := stack.ListRequest{}
|
||||
|
||||
if byId, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(byId.(int))
|
||||
}
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
|
||||
if status, ok := d.GetOk("status"); ok {
|
||||
req.Status = status.(string)
|
||||
}
|
||||
|
||||
if stackType, ok := d.GetOk("type"); ok {
|
||||
req.Type = stackType.(string)
|
||||
}
|
||||
|
||||
if sortBy, ok := d.GetOk("sort_by"); ok {
|
||||
req.SortBy = sortBy.(string)
|
||||
}
|
||||
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
log.Debugf("utilityStackListCheckPresence: load stack list")
|
||||
stackList, err := c.CloudAPI().Stack().List(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stackList, nil
|
||||
}
|
||||
@@ -20,9 +20,10 @@ func flattenAccessSEPPools(accessSEPPools stpolicy.ListAccessSEPPools) []map[str
|
||||
res := make([]map[string]interface{}, 0, len(accessSEPPools))
|
||||
for _, asp := range accessSEPPools {
|
||||
temp := map[string]interface{}{
|
||||
"sep_id": asp.SEPID,
|
||||
"sep_name": asp.Name,
|
||||
"pool_names": asp.PoolNames,
|
||||
"sep_id": asp.SEPID,
|
||||
"sep_name": asp.Name,
|
||||
"pool_names": asp.PoolNames,
|
||||
"sep_tech_status": asp.SepTechStatus,
|
||||
}
|
||||
|
||||
res = append(res, temp)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package stpolicy
|
||||
|
||||
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
|
||||
)
|
||||
|
||||
func dataSourceStoragePolicySchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
@@ -44,6 +47,10 @@ func dataSourceStoragePolicySchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"sep_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -120,6 +127,11 @@ func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
},
|
||||
"sep_tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"ENABLED", "DISABLED"}, true),
|
||||
},
|
||||
"pool_name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -174,6 +186,10 @@ func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"sep_tech_status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -56,6 +56,10 @@ func utilityStoragePolicyListCheckPresence(ctx context.Context, d *schema.Resour
|
||||
req.SepID = uint64(SEPID.(int))
|
||||
}
|
||||
|
||||
if SEPtechstatus, ok := d.GetOk("sep_tech_status"); ok {
|
||||
req.SepTechStatus = SEPtechstatus.(string)
|
||||
}
|
||||
|
||||
if poolName, ok := d.GetOk("pool_name"); ok {
|
||||
req.PoolName = poolName.(string)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ func flattenTrunk(d *schema.ResourceData, trunkItem *trunk.ItemTrunk) {
|
||||
d.Set("account_ids", trunkItem.AccountIDs)
|
||||
d.Set("ovs_bridge", trunkItem.OVSBridge)
|
||||
d.Set("native_vlan_id", trunkItem.NativeVLANID)
|
||||
d.Set("mtu", trunkItem.MTU)
|
||||
d.Set("status", trunkItem.Status)
|
||||
d.Set("trunk_tags", trunkItem.TrunkTags)
|
||||
d.Set("created_at", trunkItem.CreatedAt)
|
||||
@@ -44,6 +45,7 @@ func flattenTrunkList(trunkList *trunk.ListTrunks) []map[string]interface{} {
|
||||
"name": trunkItem.Name,
|
||||
"native_vlan_id": trunkItem.NativeVLANID,
|
||||
"ovs_bridge": trunkItem.OVSBridge,
|
||||
"mtu": trunkItem.MTU,
|
||||
"status": trunkItem.Status,
|
||||
"trunk_tags": trunkItem.TrunkTags,
|
||||
"updated_at": trunkItem.UpdatedAt,
|
||||
|
||||
@@ -52,6 +52,11 @@ func dataSourceTrunkSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "Native VLAN ID",
|
||||
},
|
||||
"mtu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Maximum Transmission Unit",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -208,6 +213,11 @@ func dataSourceTrunkListSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "OVS bridge name",
|
||||
},
|
||||
"mtu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Maximum Transmission Unit",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -84,7 +84,7 @@ func vnfConfigResourcesSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"stack_id": {
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
@@ -52,10 +52,10 @@ func flattenMGMT(mgmt vins.RecordMGMT) []map[string]interface{} {
|
||||
func flattenResources(resources vins.RecordResources) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"cpu": resources.CPU,
|
||||
"ram": resources.RAM,
|
||||
"stack_id": resources.StackID,
|
||||
"uuid": resources.UUID,
|
||||
"cpu": resources.CPU,
|
||||
"ram": resources.RAM,
|
||||
"node_id": resources.NodeID,
|
||||
"uuid": resources.UUID,
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
|
||||
@@ -58,6 +58,10 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"auto_start": {
|
||||
Type: schema.TypeBool,
|
||||
Required: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -115,6 +115,10 @@ func dataSourceZoneListSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"auto_start": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -59,6 +59,7 @@ func flattenZone(d *schema.ResourceData, item *zone.RecordZone) error {
|
||||
d.Set("lb_ids", item.LBIDs)
|
||||
d.Set("bservice_ids", item.BserviceIDs)
|
||||
d.Set("k8s_ids", item.K8SIDs)
|
||||
d.Set("auto_start", item.AutoStart)
|
||||
|
||||
log.Debugf("flattenZone: decoded RecordZone name %q / ID %d, complete",
|
||||
item.Name, item.ID)
|
||||
@@ -80,6 +81,7 @@ func flattenZoneList(zone *zone.ListZones) []map[string]interface{} {
|
||||
"created_time": zone.CreatedTime,
|
||||
"updated_time": zone.UpdatedTime,
|
||||
"node_ids": zone.NodeIDs,
|
||||
"auto_start": zone.AutoStart,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user