Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions libvirt/resource_libvirt_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ func resourceLibvirtNetwork() *schema.Resource {
Required: false,
Computed: true,
},
"active": {
Type: schema.TypeBool,
Optional: true,
Default: true,
ForceNew: false,
Required: false,
},
"dns": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -516,6 +523,13 @@ func resourceLibvirtNetworkRead(ctx context.Context, d *schema.ResourceData, met
return diag.Errorf("error retrieving libvirt network %s", err)
}

activeInt, err := virConn.NetworkIsActive(network)
if err != nil {
return diag.Errorf("error when getting network %s status during read: %s", network.Name, err)
}

d.Set("active", int2bool(int(activeInt)))

networkDef, err := getXMLNetworkDefFromLibvirt(virConn, network)
if err != nil {
return diag.Errorf("error reading libvirt network XML description: %s", err)
Expand Down