diff --git a/internal/services/containers/container_registry_task_schedule_run_now_resource.go b/internal/services/containers/container_registry_task_schedule_run_now_resource.go index a77db842a0f7..0ad4ba38b89d 100644 --- a/internal/services/containers/container_registry_task_schedule_run_now_resource.go +++ b/internal/services/containers/container_registry_task_schedule_run_now_resource.go @@ -8,6 +8,7 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/registries" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/runs" "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2019-06-01-preview/tasks" @@ -104,8 +105,9 @@ func (r ContainerRegistryTaskScheduleResource) Create() sdk.ResourceFunc { runName := "" for _, v := range *run.Model { - if *v.Properties.Task == taskId.TaskName { - runName = *v.Name + if v.Properties != nil && pointer.From(v.Properties.Task) == taskId.TaskName { + runName = pointer.From(v.Name) + break } }