diff --git a/CHANGELOG.md b/CHANGELOG.md index 5652ad8029..a90d9c5104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 1.64.2 (Apr 17, 2024) +BugFixes +* fix(ibm_database resource): Fix cpuEnforcement multitenant bug + ([5271](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5271)) + +# 1.64.1 (Apr 12, 2024) +BugFixes +* The terraform-provider-ibm_v1.64.0 plugin crashed! ([5258](https://github.com/IBM-Cloud/terraform-provider-ibm/issues/5258)) +* ibm_pi_instance: pi_network attribute :: Provider incorrectly seems to detect a change, applies it - next apply incorrectly detects the same change ([5201](https://github.com/IBM-Cloud/terraform-provider-ibm/pull/5201)) + # 1.64.0 (Apr 03, 2024) Features * Support for Privileged Access Gateway diff --git a/ibm/service/database/resource_ibm_database.go b/ibm/service/database/resource_ibm_database.go index 6d255c9524..b5fb8e7500 100644 --- a/ibm/service/database/resource_ibm_database.go +++ b/ibm/service/database/resource_ibm_database.go @@ -544,6 +544,14 @@ func ResourceIBMDatabaseInstance() *schema.Resource { "id": { Type: schema.TypeString, Required: true, + ValidateFunc: validation.StringInSlice([]string{ + "multitenant", + "b3c.4x16.encrypted", + "b3c.8x32.encrypted", + "m3c.8x64.encrypted", + "b3c.16x64.encrypted", + "b3c.32x128.encrypted", + "m3c.30x240.encrypted"}, false), }, }, }, @@ -1054,8 +1062,11 @@ func getDefaultScalingGroups(_service string, _plan string, _hostFlavor string, getDefaultScalingGroupsOptions.SetHostFlavor(_hostFlavor) } - getDefaultScalingGroupsResponse, _, err := cloudDatabasesClient.GetDefaultScalingGroups(getDefaultScalingGroupsOptions) + getDefaultScalingGroupsResponse, response, err := cloudDatabasesClient.GetDefaultScalingGroups(getDefaultScalingGroupsOptions) if err != nil { + if response.StatusCode == 422 { + return groups, fmt.Errorf("%s is not available on multitenant", service) + } return groups, err } @@ -2926,10 +2937,14 @@ func validateGroupsDiff(_ context.Context, diff *schema.ResourceDiff, meta inter tfGroups := expandGroups(group.(*schema.Set).List()) - err, cpuEnforcementRatioCeiling, cpuEnforcementRatioMb := getCpuEnforcementRatios(service, plan, meta, group) + cpuEnforcementRatioCeiling, cpuEnforcementRatioMb := 0, 0 - if err != nil { - return err + if memberGroup.HostFlavor != nil && memberGroup.HostFlavor.ID == "multitenant" { + err, cpuEnforcementRatioCeiling, cpuEnforcementRatioMb = getCpuEnforcementRatios(service, plan, memberGroup.HostFlavor.ID, meta, group) + + if err != nil { + return err + } } // validate group_ids are unique @@ -3010,9 +3025,9 @@ func validateGroupsDiff(_ context.Context, diff *schema.ResourceDiff, meta inter return nil } -func getCpuEnforcementRatios(service string, plan string, meta interface{}, group interface{}) (err error, cpuEnforcementRatioCeiling int, cpuEnforcementRatioMb int) { +func getCpuEnforcementRatios(service string, plan string, hostFlavor string, meta interface{}, group interface{}) (err error, cpuEnforcementRatioCeiling int, cpuEnforcementRatioMb int) { var currentGroups []Group - defaultList, err := getDefaultScalingGroups(service, plan, "multitenant", meta) + defaultList, err := getDefaultScalingGroups(service, plan, hostFlavor, meta) if err != nil { return err, 0, 0 diff --git a/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go b/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go index b9642cb1b1..c54a2e11d4 100644 --- a/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go +++ b/ibm/service/database/resource_ibm_database_mongodb_enterprise_test.go @@ -208,6 +208,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseBasic(databaseResourceGroup location = "%[3]s" adminpassword = "password12345678" tags = ["one:two"] + service_endpoints = "public" group { group_id = "member" host_flavor { diff --git a/ibm/service/database/resource_ibm_database_postgresql_test.go b/ibm/service/database/resource_ibm_database_postgresql_test.go index 2dd639ff58..7d11ef0837 100644 --- a/ibm/service/database/resource_ibm_database_postgresql_test.go +++ b/ibm/service/database/resource_ibm_database_postgresql_test.go @@ -416,6 +416,7 @@ func testAccCheckIBMDatabaseInstancePostgresBasic(databaseResourceGroup string, plan = "standard" location = "%[3]s" adminpassword = "password12345678" + service_endpoints = "public" group { group_id = "member" memory { diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go index b3e6843848..0b15c351d4 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go @@ -4155,18 +4155,18 @@ func resourceIBMIsBareMetalServerMapToVirtualNetworkInterfaceIPsReservedIPProtot model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } @@ -4174,86 +4174,85 @@ func resourceIBMIsBareMetalServerMapToVirtualNetworkInterfacePrimaryIPReservedIP model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } func resourceIBMIsBareMetalServerMapToVirtualNetworkInterfacePrototypeAttachmentContext(allowipspoofing, autodelete, enablenat string, d *schema.ResourceData, modelMap map[string]interface{}) (vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, error) { model := &vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface{} - if _, ok := d.GetOkExists(allowipspoofing); ok && modelMap["allow_ip_spoofing"] != nil { - model.AllowIPSpoofing = core.BoolPtr(modelMap["allow_ip_spoofing"].(bool)) - } - if _, ok := d.GetOkExists(autodelete); ok && modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if _, ok := d.GetOkExists(enablenat); ok && modelMap["enable_infrastructure_nat"] != nil { - model.EnableInfrastructureNat = core.BoolPtr(modelMap["enable_infrastructure_nat"].(bool)) - } - if modelMap["ips"] != nil && modelMap["ips"].(*schema.Set).Len() > 0 { - ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} - for _, ipsItem := range modelMap["ips"].(*schema.Set).List() { - ipsItemModel, err := resourceIBMIsBareMetalServerMapToVirtualNetworkInterfaceIPsReservedIPPrototype(ipsItem.(map[string]interface{})) + if modelMap["id"] != nil && modelMap["id"].(string) != "" { + model.ID = core.StringPtr(modelMap["id"].(string)) + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { + model.Href = core.StringPtr(modelMap["href"].(string)) + } else if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { + model.CRN = core.StringPtr(modelMap["crn"].(string)) + } else { + if _, ok := d.GetOkExists(allowipspoofing); ok && modelMap["allow_ip_spoofing"] != nil { + model.AllowIPSpoofing = core.BoolPtr(modelMap["allow_ip_spoofing"].(bool)) + } + if _, ok := d.GetOkExists(autodelete); ok && modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if _, ok := d.GetOkExists(enablenat); ok && modelMap["enable_infrastructure_nat"] != nil { + model.EnableInfrastructureNat = core.BoolPtr(modelMap["enable_infrastructure_nat"].(bool)) + } + if modelMap["ips"] != nil && modelMap["ips"].(*schema.Set).Len() > 0 { + ips := []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{} + for _, ipsItem := range modelMap["ips"].(*schema.Set).List() { + ipsItemModel, err := resourceIBMIsBareMetalServerMapToVirtualNetworkInterfaceIPsReservedIPPrototype(ipsItem.(map[string]interface{})) + if err != nil { + return model, err + } + ips = append(ips, ipsItemModel) + } + model.Ips = ips + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } + if modelMap["primary_ip"] != nil && len(modelMap["primary_ip"].([]interface{})) > 0 { + PrimaryIPModel, err := resourceIBMIsBareMetalServerMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap["primary_ip"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err } - ips = append(ips, ipsItemModel) + model.PrimaryIP = PrimaryIPModel } - model.Ips = ips - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) - } - if modelMap["primary_ip"] != nil && len(modelMap["primary_ip"].([]interface{})) > 0 { - PrimaryIPModel, err := resourceIBMIsBareMetalServerMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap["primary_ip"].([]interface{})[0].(map[string]interface{})) - if err != nil { - return model, err - } - model.PrimaryIP = PrimaryIPModel - } - if modelMap["resource_group"] != nil && modelMap["resource_group"].(string) != "" { - resourceGroupId := modelMap["resource_group"].(string) - model.ResourceGroup = &vpcv1.ResourceGroupIdentity{ - ID: &resourceGroupId, + if modelMap["resource_group"] != nil && modelMap["resource_group"].(string) != "" { + resourceGroupId := modelMap["resource_group"].(string) + model.ResourceGroup = &vpcv1.ResourceGroupIdentity{ + ID: &resourceGroupId, + } } - } - if modelMap["security_groups"] != nil { - securityGroups := []vpcv1.SecurityGroupIdentityIntf{} - sg := modelMap["security_groups"].(*schema.Set) - for _, v := range sg.List() { - value := v.(string) - securityGroupsItem := &vpcv1.SecurityGroupIdentity{ - ID: &value, + if modelMap["security_groups"] != nil { + securityGroups := []vpcv1.SecurityGroupIdentityIntf{} + sg := modelMap["security_groups"].(*schema.Set) + for _, v := range sg.List() { + value := v.(string) + securityGroupsItem := &vpcv1.SecurityGroupIdentity{ + ID: &value, + } + securityGroups = append(securityGroups, securityGroupsItem) } - securityGroups = append(securityGroups, securityGroupsItem) + model.SecurityGroups = securityGroups } - model.SecurityGroups = securityGroups - } - if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { - subnetId := modelMap["subnet"].(string) - model.Subnet = &vpcv1.SubnetIdentity{ - ID: &subnetId, + if modelMap["subnet"] != nil && modelMap["subnet"].(string) != "" { + subnetId := modelMap["subnet"].(string) + model.Subnet = &vpcv1.SubnetIdentity{ + ID: &subnetId, + } } } - if modelMap["id"] != nil && modelMap["id"].(string) != "" { - model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { - model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["crn"] != nil && modelMap["crn"].(string) != "" { - model.CRN = core.StringPtr(modelMap["crn"].(string)) - } return model, nil } func resourceIBMIsBareMetalServerMapToSubnetIdentity(modelMap map[string]interface{}) (vpcv1.SubnetIdentityIntf, error) { diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_attachment.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_attachment.go index 93c4309274..18473f0d90 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_attachment.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_attachment.go @@ -1127,18 +1127,18 @@ func resourceIBMIsBareMetalServerNetworkAttachmentMapToVirtualNetworkInterfacePr model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 9d7deef928..ea5ecf3ce0 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -6322,18 +6322,18 @@ func resourceIBMIsInstanceMapToVirtualNetworkInterfaceIPsReservedIPPrototype(mod model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } @@ -6341,18 +6341,18 @@ func resourceIBMIsInstanceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototy model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go index 0a0c1ae4a6..85694516ba 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go @@ -761,18 +761,18 @@ func resourceIBMIsInstanceNetworkAttachmentMapToVirtualNetworkInterfaceIPPrototy model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} if modelMap["id"] != nil && modelMap["id"].(string) != "" { model.ID = core.StringPtr(modelMap["id"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index a2ffc31f58..d9dcbf28b0 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -2744,18 +2744,18 @@ func resourceIBMIsInstanceTemplateMapToVirtualNetworkInterfaceIPsReservedIPProto model := &vpcv1.VirtualNetworkInterfaceIPPrototype{} if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } @@ -2764,18 +2764,18 @@ func resourceIBMIsInstanceTemplateMapToVirtualNetworkInterfacePrimaryIPReservedI model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - if modelMap["auto_delete"] != nil { - model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) - } - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["auto_delete"] != nil { + model.AutoDelete = core.BoolPtr(modelMap["auto_delete"].(bool)) + } + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } diff --git a/ibm/service/vpc/resource_ibm_is_share_mount_target.go b/ibm/service/vpc/resource_ibm_is_share_mount_target.go index 536e378303..6a4f5a8e18 100644 --- a/ibm/service/vpc/resource_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/resource_ibm_is_share_mount_target.go @@ -812,17 +812,18 @@ func ShareMountTargetMapToShareMountTargetPrototype(d *schema.ResourceData, vniM } if reservedIp != "" { primaryIpPrototype.ID = &reservedIp - } - if reservedIpAddress != "" { - primaryIpPrototype.Address = &reservedIpAddress - } + } else { + if reservedIpAddress != "" { + primaryIpPrototype.Address = &reservedIpAddress + } - if reservedIpName != "" { - primaryIpPrototype.Name = &reservedIpName - } - if autoDeleteIntf, ok := d.GetOkExists("virtual_network_interface.0.primary_ip.0.auto_delete"); ok { - reservedIpAutoDelete := autoDeleteIntf.(bool) - primaryIpPrototype.AutoDelete = &reservedIpAutoDelete + if reservedIpName != "" { + primaryIpPrototype.Name = &reservedIpName + } + if autoDeleteIntf, ok := d.GetOkExists("virtual_network_interface.0.primary_ip.0.auto_delete"); ok { + reservedIpAutoDelete := autoDeleteIntf.(bool) + primaryIpPrototype.AutoDelete = &reservedIpAutoDelete + } } vniPrototype.PrimaryIP = primaryIpPrototype } diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index 24dfd87ad5..c4e0a7fb4c 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -932,16 +932,16 @@ func resourceIBMIsVirtualNetworkInterfaceMapToVirtualNetworkInterfacePrimaryIPRe model := &vpcv1.VirtualNetworkInterfacePrimaryIPPrototype{} if modelMap["reserved_ip"] != nil && modelMap["reserved_ip"].(string) != "" { model.ID = core.StringPtr(modelMap["reserved_ip"].(string)) - } - if modelMap["href"] != nil && modelMap["href"].(string) != "" { + } else if modelMap["href"] != nil && modelMap["href"].(string) != "" { model.Href = core.StringPtr(modelMap["href"].(string)) - } - if modelMap["address"] != nil && modelMap["address"].(string) != "" { - model.Address = core.StringPtr(modelMap["address"].(string)) - } - model.AutoDelete = core.BoolPtr(autodelete) - if modelMap["name"] != nil && modelMap["name"].(string) != "" { - model.Name = core.StringPtr(modelMap["name"].(string)) + } else { + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + model.AutoDelete = core.BoolPtr(autodelete) + if modelMap["name"] != nil && modelMap["name"].(string) != "" { + model.Name = core.StringPtr(modelMap["name"].(string)) + } } return model, nil } diff --git a/version/version.go b/version/version.go index 7cdfc85f35..5c642e48da 100644 --- a/version/version.go +++ b/version/version.go @@ -5,7 +5,7 @@ import ( ) // Version is the current provider main version -const Version = "1.64.0" +const Version = "1.64.2" // GitCommit is the git commit that was compiled. This will be filled in by the compiler. var GitCommit string