kubiya_trigger
resource allows you to create and manage workflow triggers in the Kubiya platform. This resource creates a workflow and automatically publishes it with a webhook trigger, providing a URL that can be used to execute the workflow via HTTP requests.
Triggers combine the power of workflows with webhook accessibility, enabling external systems to initiate complex automation processes with a simple HTTP call.
Prerequisites
Before using this resource, ensure you have:- A Kubiya account with API access
- An API key (generated from Kubiya dashboard under Admin → Kubiya API Keys)
- A configured runner (or use “kubiya-hosted” for cloud execution)
Quick Start
Configuration Examples
Create a trigger with custom tool executors for system monitoring:
Advanced Configurations
Database Backup Automation
Database Backup Automation
Create a trigger for automated database backups with S3 upload:
Incident Response Automation
Incident Response Automation
Create a trigger for automated incident response:
Triggering Workflows
Once the trigger resource is created, you can execute the workflow by making HTTP requests to the webhook URL.Arguments Reference
Required Arguments
Name of the trigger. This will be used as the workflow name and must be unique within your organization.
Runner to use for executing the workflow. Common values:
kubiya-hosted
- Use Kubiya’s cloud-hosted runners- Custom runner names from your organization
JSON-encoded workflow definition. Use
jsonencode()
for better readability. Structure includes:Name of the workflow for identification.
Version number of the workflow. Increment when making changes.
Array of workflow steps, each containing:
Unique name for the step within the workflow.
Description of what the step does.
Executor configuration with
type
and config
:type
: “command”, “tool”, or “agent”config
: Configuration object specific to the executor type
Array of step names this step depends on for execution order.
Variable name to store step output for use in subsequent steps.
Attributes Reference
In addition to all arguments above, the following attributes are exported:The unique identifier of the trigger.
The webhook URL for triggering the workflow (sensitive).
Current status of the workflow (e.g., “draft”, “published”).
The ID of the created workflow in Kubiya.
Import
Trigger resources can be imported using their ID:Best Practices
Security
- Store the webhook URL as a sensitive output to prevent accidental exposure
- Use proper authentication headers when triggering workflows
- Implement input validation in your workflow steps
- Restrict webhook access through network controls when possible
Workflow Design
- Use descriptive names and descriptions for steps to improve maintainability
- Design workflows to be idempotent where possible
- Include error checking and recovery steps in your workflows
- Use step dependencies to control execution order and enable parallelism
Versioning & Updates
- Increment the workflow version when making significant changes
- Test workflows in a non-production environment first
- Document breaking changes in version updates
- Keep backward compatibility when possible
Monitoring & Operations
- Set up logging and monitoring for workflow executions
- Implement proper error handling and notifications
- Use output variables to pass data between steps
- Monitor execution times and resource usage
Executor Types
Execute shell commands directly:
Compatibility
Requirements:
- Kubiya Terraform Provider version >= 1.0.0
- Terraform >= 1.0
- The workflow is automatically published when the trigger resource is created
- The webhook URL remains stable across updates unless the resource is recreated
Important Considerations:
- Updating the workflow definition will update the published workflow
- Deleting the trigger resource will delete both the workflow and webhook
- Ensure proper runner permissions for workflow execution
- Test complex workflows thoroughly before production deployment
Troubleshooting
Workflow Execution Issues
Workflow Execution Issues
- Verify the runner is active and has proper permissions
- Check workflow step dependencies for circular references
- Ensure all required tools and images are accessible
- Review step executor configurations for syntax errors
Webhook Trigger Problems
Webhook Trigger Problems
- Verify the webhook URL is accessible and not blocked
- Check authorization headers and API key validity
- Ensure payload format matches workflow expectations
- Review webhook logs for error messages
Step Dependency Issues
Step Dependency Issues
- Validate that dependency step names match exactly
- Check for circular dependencies in the workflow
- Ensure dependent steps produce expected output variables
- Review execution logs for dependency resolution errors