4.11.0
This commit is contained in:
@@ -58,6 +58,10 @@ func dataSourceZoneSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"auto_start": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: 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)
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ func resourceZoneCreate(ctx context.Context, d *schema.ResourceData, m interface
|
||||
Name: zoneName,
|
||||
}
|
||||
|
||||
if aS, ok := d.GetOk("auto_start"); ok {
|
||||
req.AutoStart = aS.(bool)
|
||||
}
|
||||
|
||||
if desc, ok := d.GetOk("description"); ok {
|
||||
req.Description = desc.(string)
|
||||
}
|
||||
@@ -113,7 +117,7 @@ func resourceZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface
|
||||
|
||||
log.Debugf("resourceZoneUpdate: called Zone with id %d", zoneID)
|
||||
|
||||
if d.HasChanges("name", "description", "node_ids") {
|
||||
if d.HasChanges("name", "description", "node_ids", "auto_start") {
|
||||
if err := utilityZoneUpdate(ctx, d, m, zoneID); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
@@ -193,6 +197,11 @@ func resourceZoneSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"auto_start": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
"zone_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
|
||||
@@ -65,7 +65,7 @@ func utilityZoneCheckPresence(ctx context.Context, d *schema.ResourceData, m int
|
||||
func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, zoneID uint64) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
if d.HasChanges("name", "description") {
|
||||
if d.HasChanges("name", "description", "auto_start") {
|
||||
req := zone.UpdateRequest{
|
||||
ID: zoneID,
|
||||
}
|
||||
@@ -77,6 +77,10 @@ func utilityZoneUpdate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
req.Description = d.Get("description").(string)
|
||||
}
|
||||
|
||||
if d.HasChange("auto_start") {
|
||||
req.AutoStart = d.Get("auto_start").(bool)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().Zone().Update(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user