@@ -32,6 +32,8 @@ func resourceSchedule() *common.Resource {
3232 StateContext : schema .ImportStatePassthroughContext ,
3333 },
3434
35+ CustomizeDiff : resourceScheduleCustomizeDiff ,
36+
3537 Schema : map [string ]* schema.Schema {
3638 "name" : {
3739 Type : schema .TypeString ,
@@ -173,10 +175,10 @@ func resourceScheduleCreate(ctx context.Context, d *schema.ResourceData, client
173175
174176 timeZoneData , timeZoneOk := d .GetOk ("time_zone" )
175177 if timeZoneOk {
176- if isScheduleTypeCalendar (typeData ) {
177- createOptions .TimeZone = timeZoneData .(string )
178- } else {
178+ if isScheduleTypeiCal (typeData ) {
179179 return diag .Errorf ("time_zone can not be set with type: %s" , typeData )
180+ } else {
181+ createOptions .TimeZone = timeZoneData .(string )
180182 }
181183 }
182184
@@ -226,10 +228,10 @@ func resourceScheduleUpdate(ctx context.Context, d *schema.ResourceData, client
226228
227229 timeZoneData , timeZoneOk := d .GetOk ("time_zone" )
228230 if timeZoneOk {
229- if isScheduleTypeCalendar (typeData ) {
230- updateOptions .TimeZone = timeZoneData .(string )
231- } else {
231+ if isScheduleTypeiCal (typeData ) {
232232 return diag .Errorf ("time_zone can not be set with type: %s" , typeData )
233+ } else {
234+ updateOptions .TimeZone = timeZoneData .(string )
233235 }
234236 }
235237
@@ -325,3 +327,31 @@ func expandScheduleSlack(in []any) *onCallAPI.SlackSchedule {
325327func isScheduleTypeCalendar (t string ) bool {
326328 return t == "calendar"
327329}
330+
331+ func isScheduleTypeiCal (t string ) bool {
332+ return t == "ical"
333+ }
334+
335+ func resourceScheduleCustomizeDiff (ctx context.Context , d * schema.ResourceDiff , m interface {}) error {
336+ oldType , _ := d .GetChange ("type" )
337+
338+ if oldType == nil {
339+ return nil
340+ }
341+
342+ if oldType .(string ) == "web" {
343+ for _ , key := range d .GetChangedKeysPrefix ("" ) {
344+ if key == "id" {
345+ continue
346+ }
347+
348+ if err := d .ForceNew (key ); err != nil {
349+ return err
350+ }
351+
352+ return nil
353+ }
354+ }
355+
356+ return nil
357+ }
0 commit comments