Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Nov 11, 2024
1 parent d099e31 commit 901fd01
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/server/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ func Resource() *schema.Resource {
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeInt},
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { // nolint:revive
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool { // nolint:revive
sup := d.Get("ignore_remote_firewall_ids").(bool)
if sup && old != "" && new != "" {
if sup && oldValue != "" && newValue != "" {
return true
}
return false
Expand Down Expand Up @@ -274,14 +274,14 @@ func userDataHashSum(userData string) string {
return base64.StdEncoding.EncodeToString(sum[:])
}

func userDataDiffSuppress(k, old, new string, d *schema.ResourceData) bool {
func userDataDiffSuppress(k, oldValue, newValue string, d *schema.ResourceData) bool {
userData := d.Get(k).(string)
if new != "" && userData != "" {
if _, err := base64.StdEncoding.DecodeString(old); err != nil {
return userDataHashSum(old) == new
if newValue != "" && userData != "" {
if _, err := base64.StdEncoding.DecodeString(oldValue); err != nil {
return userDataHashSum(oldValue) == newValue
}
}
return strings.TrimSpace(old) == strings.TrimSpace(new)
return strings.TrimSpace(oldValue) == strings.TrimSpace(newValue)
}

func resourceServerCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
Expand Down

0 comments on commit 901fd01

Please sign in to comment.