Overview
External resources in Serverless Workflow allow you to define and access external assets or services required for workflow execution. These resources can include:- APIs
- Databases
- Files
- Configuration services
- Third-party services
- Any other external entities needed by the workflow
Benefits
By defining external resources within the workflow, you:- Centralize resource management - All external dependencies are defined in one place
- Streamline access - Simplified and consistent access patterns across tasks
- Enhance security - Built-in authentication and authorization support
- Improve maintainability - Easy to update resource locations or credentials
- Promote modularity - Clear separation between workflow logic and external dependencies
Defining External Resources
Each external resource is identified by:- A unique name for reference within the workflow
- A URI specifying its location
- Optional authentication policy for secure access
Basic Example
Authentication
External resources can specify authentication policies to ensure secure access. The Serverless Workflow DSL supports several standard authentication mechanisms:Basic Authentication
Utilizes a username-password pair for authentication:Bearer Authentication
Uses a bearer token for authentication:OAuth2 Authentication
Implements OAuth2 authorization framework for secure access:Reusable Authentication Policies
You can define authentication policies separately and reference them by name:Using External Resources in Tasks
HTTP Calls
OpenAPI Calls
gRPC Calls
Advanced Examples
Multiple Environments
Use runtime expressions to select resources based on environment:Database Resources
File Resources
Security Best Practices
Use Secrets for Credentials
Never hardcode credentials in your workflow definitions. Always use the
$secrets runtime expression to reference sensitive information:Limit Secret Exposure
The
$secrets runtime expression is only available in input.from expressions to prevent accidental exposure. Plan your authentication accordingly.Use OAuth2 When Possible
OAuth2 provides better security than basic authentication, especially for production systems. It supports token expiration, refresh, and granular access control.
Validate Resource Responses
Use output schemas to validate responses from external resources, ensuring data integrity and catching issues early.
Frequently Asked Questions
What's the difference between external resources and catalogs?
What's the difference between external resources and catalogs?
External resources are specific endpoints or services that your workflow needs to access (APIs, databases, files). Catalogs are collections of reusable functions that can be shared across workflows. External resources are about where to find things, while catalogs are about what reusable components are available.
Can I use the same resource with different authentication in different tasks?
Can I use the same resource with different authentication in different tasks?
Yes! You can override the authentication at the task level by specifying a different authentication policy in the call configuration.
How do I handle resources that require dynamic URLs?
How do I handle resources that require dynamic URLs?
You can use runtime expressions in the URI property or construct the full URI in your task:
Can external resources be used with custom functions?
Can external resources be used with custom functions?
Yes! Custom functions can reference external resources defined in the workflow. The resource definitions are available to all tasks, including those within custom functions.
What happens if an external resource is unavailable?
What happens if an external resource is unavailable?