diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 1e1e0636d8..6a47492b0c 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -237,7 +237,7 @@ func ResourceIBMISInstance() *schema.Resource { Optional: true, Computed: true, DiffSuppressOnRefresh: true, - DiffSuppressFunc: flex.ApplyOnce, + DiffSuppressFunc: flex.ApplyOnlyOnce, Description: "Indicates whether this cluster network interface will be automatically deleted when `target` is deleted.", }, "name": &schema.Schema{ @@ -275,7 +275,7 @@ func ResourceIBMISInstance() *schema.Resource { Type: schema.TypeBool, Optional: true, Computed: true, - DiffSuppressFunc: flex.ApplyOnce, + DiffSuppressFunc: flex.ApplyOnlyOnce, Description: "Indicates whether this cluster network subnet reserved IP member will be automatically deleted when either `target` is deleted, or the cluster network subnet reserved IP is unbound.", }, "name": &schema.Schema{ @@ -8351,10 +8351,22 @@ func compareInterfaces(old, new map[string]interface{}) bool { func buildCreateClusterNetworkAttachmentOptions(instanceID string, attachment map[string]interface{}) *vpcv1.CreateClusterNetworkAttachmentOptions { networkInterface := attachment["cluster_network_interface"].([]interface{})[0].(map[string]interface{}) + clusterNetworkInterface := &vpcv1.InstanceClusterNetworkAttachmentPrototypeClusterNetworkInterface{} - if autoDelete, ok := networkInterface["auto_delete"].(bool); ok { - clusterNetworkInterface.AutoDelete = &autoDelete + // if autoDelete, ok := networkInterface["auto_delete"].(bool); ok { + // clusterNetworkInterface.AutoDelete = &autoDelete + // } + if autoDelete, ok := networkInterface["auto_delete"]; ok { + // Convert interface{} to bool properly + autoDeletBool := false + switch v := autoDelete.(type) { + case bool: + autoDeletBool = v + case string: + autoDeletBool = v == "true" + } + clusterNetworkInterface.AutoDelete = &autoDeletBool } if name, ok := networkInterface["name"].(string); ok {