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

Waitingroom event bugfix #1648

Merged
merged 8 commits into from May 27, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1648.txt
@@ -0,0 +1,3 @@
```release-note:bug
resource/cloudflare_waiting_room_event: handle time pointer for nullable struct member
```
8 changes: 5 additions & 3 deletions internal/provider/resource_cloudflare_waiting_room_event.go
Expand Up @@ -42,19 +42,21 @@ func expandWaitingRoomEvent(d *schema.ResourceData) (cloudflare.WaitingRoomEvent
return cloudflare.WaitingRoomEvent{}, err
}

prequeueStartTime := time.Time{}
var prequeueStartTime *time.Time
if t, ok := d.GetOk("prequeue_start_time"); ok {
prequeueStartTime, err = time.Parse(time.RFC3339, t.(string))
prequeueStartTimeValue, err := time.Parse(time.RFC3339, t.(string))
jacobbednarz marked this conversation as resolved.
Show resolved Hide resolved
prequeueStartTime = &prequeueStartTimeValue
if err != nil {
return cloudflare.WaitingRoomEvent{}, err
}
}

return cloudflare.WaitingRoomEvent{
ID: d.Id(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is going to error in the Create where it is referenced as d.SetId() isn't called until after the API calls are made and this value doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I'll just extract from the ResourceData and set it manually.

Name: d.Get("name").(string),
EventStartTime: eventStartTime,
EventEndTime: eventEndTime,
PrequeueStartTime: &prequeueStartTime,
PrequeueStartTime: prequeueStartTime,
Description: d.Get("description").(string),
QueueingMethod: d.Get("queueing_method").(string),
ShuffleAtEventStart: d.Get("shuffle_at_event_start").(bool),
Expand Down