Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 21 additions & 6 deletions ibm/service/database/resource_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
},
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func testAccCheckIBMDatabaseInstanceMongoDBEnterpriseBasic(databaseResourceGroup
location = "%[3]s"
adminpassword = "password12345678"
tags = ["one:two"]
service_endpoints = "public"
group {
group_id = "member"
host_flavor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ func testAccCheckIBMDatabaseInstancePostgresBasic(databaseResourceGroup string,
plan = "standard"
location = "%[3]s"
adminpassword = "password12345678"
service_endpoints = "public"
group {
group_id = "member"
memory {
Expand Down
151 changes: 75 additions & 76 deletions ibm/service/vpc/resource_ibm_is_bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4155,105 +4155,104 @@ 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
}
func resourceIBMIsBareMetalServerMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
44 changes: 22 additions & 22 deletions ibm/service/vpc/resource_ibm_is_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -6322,37 +6322,37 @@ 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
}
func resourceIBMIsInstanceMapToVirtualNetworkInterfacePrimaryIPReservedIPPrototype(modelMap map[string]interface{}) (vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeIntf, error) {
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
}
Expand Down
22 changes: 11 additions & 11 deletions ibm/service/vpc/resource_ibm_is_instance_network_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading