Skip to content

Commit

Permalink
Merge pull request #2076 from Justin-Holmes/jholmes/access-remove-def…
Browse files Browse the repository at this point in the history
…ault

Suppress session_duration diffs for bookmark applications
  • Loading branch information
jacobbednarz authored Dec 9, 2022
2 parents 4972d09 + 6d649cd commit 6dfa100
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 6dfa100

Please sign in to comment.