terraform-provider-stackgen

sg_agent_schedule (Resource)

⚠️ Experimental — This resource is part of the Guild platform and may change in future releases.

Manages a scheduled (cron) task attached to an sg_agent, sg_workflow, or installed app, using the same target_type / target_name pairing as sg_webhook (agent, workflow, or app). For app targets set endpoint_path (and optionally endpoint_payload).

Set provider workspace_id to keep the schedule in the same workspace as agents, workflows, and webhooks. Import using the schedule ID.

Example Usage

# Set provider workspace_id to keep schedules in the same workspace as agents and workflows
# (same org as agents, workflows, and sg_webhook).

resource "sg_agent" "example" {
  name = "scheduled-agent"
}

resource "sg_agent_schedule" "example" {
  target_type = "agent"
  target_name = sg_agent.example.name
  name        = "nightly-summary"
  expression  = "0 7 * * *"
  action      = "Summarize open incidents and post to the team channel."
  enabled     = true
}

# Workflow example (requires an sg_workflow resource):
# resource "sg_agent_schedule" "workflow_cron" {
#   target_type = "workflow"
#   target_name = sg_workflow.my_pipeline.name
#   name        = "hourly-workflow"
#   expression  = "0 * * * *"
#   action      = "Default input for each scheduled workflow run."
#   enabled     = true
# }

Import

Import an existing sg_agent_schedule using its schedule ID:

terraform import sg_agent_schedule.example '123e4567-e89b-12d3-a456-426614174000'

Schema

Required

Optional

Read-Only