Skip to content

Commit

Permalink
Suppress session_duration diffs for bookmark applications
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-Holmes committed Dec 7, 2022
1 parent 24ed3d8 commit 5e095a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/2076.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/access_application: fix issue where session_duration always showed a diff for bookmark apps
```
10 changes: 10 additions & 0 deletions internal/provider/schema_cloudflare_access_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ func resourceCloudflareAccessApplicationSchema() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
Default: "24h",
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
appType := d.Get("type").(string)
// Suppress the diff if it's a bookmark app type. Bookmarks don't have a session duration
// field which always creates a diff because of the default '24h' value.
if appType == "bookmark" {
return true
}

return oldValue == newValue
},
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
v := val.(string)
_, err := time.ParseDuration(v)
Expand Down

0 comments on commit 5e095a4

Please sign in to comment.