Skip to content

Commit 4ddbc65

Browse files
committed
roll back diffSuppressFunc
1 parent 5a566c1 commit 4ddbc65

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

internal/services/baremetal/helpers.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ func getOfferInformations(ctx context.Context, offer interface{}, id string, i i
235235

236236
if validation.IsUUID(regional.ExpandID(offer.(string)).ID) {
237237
offerID := regional.ExpandID(offer.(string))
238-
239238
return FindOfferByID(ctx, api, zone.Zone, offerID.ID)
240239
} else {
241240
return api.GetOfferByName(&baremetal.GetOfferByNameRequest{

internal/services/baremetal/server.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ func ResourceServer() *schema.Resource {
5959
Required: true,
6060
Description: "ID or name of the server offer",
6161
ValidateDiagFunc: verify.IsUUIDOrNameOffer(),
62+
DiffSuppressFunc: func(_, oldValue, newValue string, d *schema.ResourceData) bool {
63+
// remove the locality from the IDs when checking diff
64+
if locality.ExpandID(newValue) == locality.ExpandID(oldValue) {
65+
return true
66+
}
67+
// if the offer was provided by name
68+
offerName, ok := d.GetOk("offer_name")
69+
70+
return ok && newValue == offerName
71+
},
6272
},
6373
"offer_id": {
6474
Type: schema.TypeString,

0 commit comments

Comments
 (0)