Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Commit

Permalink
workaround for #263 #266
Browse files Browse the repository at this point in the history
  • Loading branch information
iwarapter committed Apr 25, 2023
1 parent 142edd8 commit d82dbdb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pingfederate-version: [ 10.2.7, 10.3.7, 11.0.4, 11.1.1 ]
pingfederate-version: [ 10.2.7, 10.3.7, 11.0.4, 11.1.1, 11.2.0 ]
services:
ldap:
image: osixia/openldap:1.5.0
Expand Down
7 changes: 7 additions & 0 deletions internal/framework/pingfederate_oauth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package framework
import (
"context"
"fmt"
"math/big"

"github.com/hashicorp/terraform-plugin-framework/attr"

Expand Down Expand Up @@ -372,6 +373,12 @@ func (r *pingfederateOAuthClientResource) versionResponseModifier(data *ClientDa
data.RequireJwtSecuredAuthorizationResponseMode = types.BoolValue(false)
}

// depending on the backing store for oauth clients, the following fields may be null
// if they are null, we need to set them to 0 so that the state is happy
if data.PersistentGrantExpirationTime.IsNull() {
data.PersistentGrantExpirationTime = types.NumberValue(big.NewFloat(0))
}

return data
}

Expand Down
6 changes: 4 additions & 2 deletions internal/framework/pingfederate_oauth_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package framework
import (
"context"
"fmt"
"math/big"
"testing"

"github.com/hashicorp/terraform-plugin-framework/attr"
Expand Down Expand Up @@ -776,8 +777,9 @@ func Test_resourcePingFederateOAuthClientResourceVersionModifications(t *testing
before := defaults
res.versionRequestModifier(&before)
assert.Equal(t, tt.after, before)

assert.Equal(t, defaults, *res.versionResponseModifier(&before))
defaultsCopy := defaults
defaultsCopy.PersistentGrantExpirationTime = types.NumberValue(big.NewFloat(0))
assert.Equal(t, defaultsCopy, *res.versionResponseModifier(&before))
})
}
}

0 comments on commit d82dbdb

Please sign in to comment.