4.4.3
This commit is contained in:
@@ -735,7 +735,7 @@ func resourceComputeUpdate(ctx context.Context, d *schema.ResourceData, m interf
|
||||
Name: d.Get("name").(string),
|
||||
}
|
||||
|
||||
if desc, ok := d.GetOk("desc"); ok {
|
||||
if desc, ok := d.GetOk("description"); ok {
|
||||
req.Description = desc.(string)
|
||||
}
|
||||
|
||||
@@ -1504,8 +1504,8 @@ func disksSubresourceSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"permanently": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
Description: "Disk deletion status",
|
||||
},
|
||||
"disk_id": {
|
||||
@@ -1613,15 +1613,15 @@ func ResourceComputeSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Name of this compute. Compute names are case sensitive and must be unique in the resource group.",
|
||||
},
|
||||
"rg_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
// ForceNew: true,
|
||||
ValidateFunc: validation.IntAtLeast(1),
|
||||
Description: "ID of the resource group where this compute should be deployed.",
|
||||
},
|
||||
"driver": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
// ForceNew: true,
|
||||
StateFunc: statefuncs.StateFuncToUpper,
|
||||
ValidateFunc: validation.StringInSlice([]string{"SVA_KVM_X86", "KVM_X86", "KVM_PPC"}, false), // observe case while validating
|
||||
|
||||
@@ -97,14 +97,13 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
setQuota = true
|
||||
}
|
||||
|
||||
log.Debugf("resourceResgroupCreate: called by user %q for RG name %s, account ID %d",
|
||||
c.GetDecortUsername(),
|
||||
log.Debugf("resourceResgroupCreate: called for RG name %s, account ID %d",
|
||||
// c.GetDecortUsername(),
|
||||
rgName.(string), d.Get("account_id").(int))
|
||||
|
||||
req.AccountID = uint64(d.Get("account_id").(int))
|
||||
req.Name = rgName.(string)
|
||||
req.GID = uint64(location.DefaultGridID)
|
||||
req.Owner = c.GetDecortUsername()
|
||||
|
||||
if setQuota {
|
||||
req.MaxCPUCapacity = int64(quotaRecord.Cpu)
|
||||
@@ -121,6 +120,11 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
d.Set("def_net_type", "PRIVATE")
|
||||
}
|
||||
|
||||
owner, ok := d.GetOk("owner")
|
||||
if ok {
|
||||
req.Owner = owner.(string)
|
||||
}
|
||||
|
||||
ipcidr, ok := d.GetOk("ipcidr")
|
||||
if ok {
|
||||
req.IPCIDR = ipcidr.(string)
|
||||
@@ -658,6 +662,11 @@ func ResourceRgSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Address of the netowrk inside the private network segment (aka ViNS) if def_net_type=PRIVATE",
|
||||
},
|
||||
|
||||
"owner": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
"ext_net_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
||||
@@ -105,14 +105,14 @@ func flattenAccRGResources(argr account.RGResuorces) []map[string]interface{} {
|
||||
func flattenAccResources(r account.RecordResourceConsumption) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"current": flattenAccResource(r.Current),
|
||||
"current": flattenAccResource(r.Consumed),
|
||||
"reserved": flattenAccResource(r.Reserved),
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenAccConsumed(c account.Consumed) []map[string]interface{} {
|
||||
func flattenAccConsumed(c account.Resource) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"cpu": c.CPU,
|
||||
|
||||
@@ -65,15 +65,14 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
}
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
log.Debugf("resourceResgroupCreate: called by user %q for RG name %s, account ID %d",
|
||||
c.GetDecortUsername(),
|
||||
log.Debugf("resourceResgroupCreate: called for RG name %s, account ID %d",
|
||||
// c.GetDecortUsername(),
|
||||
rg_name.(string), d.Get("account_id").(int))
|
||||
|
||||
req := rg.CreateRequest{
|
||||
AccountID: uint64(d.Get("account_id").(int)),
|
||||
Name: rg_name.(string),
|
||||
GID: uint64(location.DefaultGridID),
|
||||
Owner: c.GetDecortUsername(),
|
||||
}
|
||||
|
||||
// pass quota values as set
|
||||
@@ -91,7 +90,10 @@ func resourceResgroupCreate(ctx context.Context, d *schema.ResourceData, m inter
|
||||
if arg_set {
|
||||
req.DefNet = def_net_type.(string)
|
||||
}
|
||||
|
||||
owner, ok := d.GetOk("owner")
|
||||
if ok {
|
||||
req.Owner = owner.(string)
|
||||
}
|
||||
ipcidr, arg_set := d.GetOk("ipcidr")
|
||||
if arg_set {
|
||||
req.IPCIDR = ipcidr.(string)
|
||||
@@ -338,6 +340,11 @@ func ResourceResgroup() *schema.Resource {
|
||||
Description: "IP address on the external netowrk to request when def_net_type=PRIVATE and ext_net_id is not 0",
|
||||
},
|
||||
|
||||
"owner": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
/* commented out, as in this version of provider we use default Grid ID
|
||||
"grid_id": {
|
||||
Type: schema.TypeInt,
|
||||
|
||||
Reference in New Issue
Block a user