@@ -350,7 +350,6 @@ func resourceCloudStackNetworkOfferingRead(d *schema.ResourceData, meta interfac
350350 d .Set ("guest_ip_type" , n .Guestiptype )
351351 d .Set ("traffic_type" , n .Traffictype )
352352
353- // Only set optional attributes if they were specified in the configuration
354353 if _ , ok := d .GetOk ("network_rate" ); ok {
355354 d .Set ("network_rate" , n .Networkrate )
356355 }
@@ -384,15 +383,14 @@ func resourceCloudStackNetworkOfferingRead(d *schema.ResourceData, meta interfac
384383 if _ , ok := d .GetOk ("routing_mode" ); ok {
385384 d .Set ("routing_mode" , n .Routingmode )
386385 }
387- // Set max_connections if it was specified in the configuration
388- // Note: CloudStack may return 0 even when a value was set, so we preserve the configured value
389- if configuredMaxConn := d . Get ( "max_connections" ).( int ); configuredMaxConn != 0 {
390- d . Set ( "max_connections" , configuredMaxConn )
391- } else if n .Maxconnections != 0 {
392- d . Set ( "max_connections" , n . Maxconnections )
386+ if _ , ok := d . GetOk ( "max_connections" ); ok {
387+ log . Printf ( "[DEBUG] Max connections configured: %d, CloudStack returned: %d" , d . Get ( "max_connections" ).( int ), n . Maxconnections )
388+
389+ if n . Maxconnections > 0 {
390+ d . Set ( "max_connections" , n .Maxconnections )
391+ }
393392 }
394393
395- // Set supported services if specified
396394 if _ , ok := d .GetOk ("supported_services" ); ok && len (n .Service ) > 0 {
397395 services := make ([]string , len (n .Service ))
398396 for i , service := range n .Service {
@@ -401,7 +399,6 @@ func resourceCloudStackNetworkOfferingRead(d *schema.ResourceData, meta interfac
401399 d .Set ("supported_services" , services )
402400 }
403401
404- // Set service provider list if specified
405402 if _ , ok := d .GetOk ("service_provider_list" ); ok && len (n .Service ) > 0 {
406403 serviceProviders := make (map [string ]string )
407404 for _ , service := range n .Service {
0 commit comments