Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate time zones #473

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pagerduty/resource_pagerduty_ruleset_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ func resourcePagerDutyRulesetRule() *schema.Resource {
"timezone": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
_, err := time.LoadLocation(val.(string))
if err != nil {
errs = append(errs, err)
}
return
},
},
"start_time": {
Type: schema.TypeInt,
Expand Down
7 changes: 7 additions & 0 deletions pagerduty/resource_pagerduty_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ func resourcePagerDutySchedule() *schema.Resource {
"time_zone": {
Type: schema.TypeString,
Required: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
_, err := time.LoadLocation(val.(string))
if err != nil {
errs = append(errs, err)
}
return
},
},

"overflow": {
Expand Down
7 changes: 7 additions & 0 deletions pagerduty/resource_pagerduty_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ func resourcePagerDutyService() *schema.Resource {
"time_zone": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
_, err := time.LoadLocation(val.(string))
if err != nil {
errs = append(errs, err)
}
return
},
},
"start_time": {
Type: schema.TypeString,
Expand Down
7 changes: 7 additions & 0 deletions pagerduty/resource_pagerduty_service_event_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ func resourcePagerDutyServiceEventRule() *schema.Resource {
"timezone": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
_, err := time.LoadLocation(val.(string))
if err != nil {
errs = append(errs, err)
}
return
},
},
"start_time": {
Type: schema.TypeInt,
Expand Down
7 changes: 7 additions & 0 deletions pagerduty/resource_pagerduty_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ func resourcePagerDutyUser() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
_, err := time.LoadLocation(val.(string))
if err != nil {
errs = append(errs, err)
}
return
},
},

"html_url": {
Expand Down