This commit is contained in:
Nikita Sorokin
2023-10-13 13:28:19 +03:00
parent 28b60de115
commit 0602a4b693
104 changed files with 3804 additions and 301 deletions

View File

@@ -146,7 +146,7 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"disk_total": {
Type: schema.TypeString,
Type: schema.TypeInt,
Computed: true,
},
"gid": {
@@ -185,13 +185,13 @@ func dataSourceBasicServiceSchemaMake() map[string]*schema.Schema {
},
},
},
"groups_name": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
// "groups_name": {
// Type: schema.TypeList,
// Computed: true,
// Elem: &schema.Schema{
// Type: schema.TypeString,
// },
// },
"guid": {
Type: schema.TypeInt,
Computed: true,

View File

@@ -93,6 +93,16 @@ func resourceBasicServiceCreate(ctx context.Context, d *schema.ResourceData, m i
return diag.FromErr(err)
}
}
if d.Get("start").(bool) && d.Get("enable").(bool) {
log.Debugf("trying to start bservice %v", serviceId)
_, err := c.CloudAPI().BService().Enable(ctx, bservice.EnableRequest{
ServiceID: serviceId,
})
if err != nil {
return diag.FromErr(err)
}
}
return resourceBasicServiceRead(ctx, d, m)
}
@@ -552,7 +562,7 @@ func resourceBasicServiceSchemaMake() map[string]*schema.Schema {
Computed: true,
},
"disk_total": {
Type: schema.TypeString,
Type: schema.TypeInt,
Computed: true,
},
"gid": {

View File

@@ -107,6 +107,20 @@ func resourceBasicServiceGroupCreate(ctx context.Context, d *schema.ResourceData
d.SetId(strconv.FormatUint(compgroupId, 10))
d.Set("compgroup_id", compgroupId)
serviceId:= uint64(d.Get("service_id").(int))
if d.Get("start").(bool) {
log.Debugf("trying to start bservice group %v", compgroupId)
_, err := c.CloudAPI().BService().GroupStart(ctx, bservice.GroupStartRequest{
ServiceID: serviceId,
CompGroupID: compgroupId,
})
if err != nil {
return diag.FromErr(err)
}
}
return resourceBasicServiceGroupRead(ctx, d, m)
}