1. Packages
  2. Prefect Provider
  3. API Docs
  4. getWorkerMetadata
prefect 2.22.4 published on Wednesday, Mar 26, 2025 by prefecthq

prefect.getWorkerMetadata

Explore with Pulumi AI

prefect logo
prefect 2.22.4 published on Wednesday, Mar 26, 2025 by prefecthq

    Get metadata information about the common Worker types, such as Kubernetes, ECS, etc.
    Use this data source to get the default base job configurations for those common Worker types.
    For more information, see workers.

    This feature is available in the following product plan(s): Prefect OSS, Prefect Cloud (Free), Prefect Cloud (Pro), Prefect Cloud (Enterprise).

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as prefect from "@pulumi/prefect";
    
    const workerMetadata = prefect.getWorkerMetadata({});
    const kubernetes = new prefect.WorkPool("kubernetes", {
        type: "kubernetes",
        workspaceId: data.prefect_workspace.prd.id,
        paused: false,
        baseJobTemplate: workerMetadata.then(workerMetadata => workerMetadata.baseJobConfigs?.kubernetes),
    });
    const ecs = new prefect.WorkPool("ecs", {
        type: "ecs",
        workspaceId: data.prefect_workspace.prd.id,
        paused: false,
        baseJobTemplate: workerMetadata.then(workerMetadata => workerMetadata.baseJobConfigs?.ecs),
    });
    const process = new prefect.WorkPool("process", {
        type: "cloud-run:push",
        workspaceId: data.prefect_workspace.prd.id,
        paused: false,
        baseJobTemplate: workerMetadata.then(workerMetadata => workerMetadata.baseJobConfigs?.cloudRunPush),
    });
    
    import pulumi
    import pulumi_prefect as prefect
    
    worker_metadata = prefect.get_worker_metadata()
    kubernetes = prefect.WorkPool("kubernetes",
        type="kubernetes",
        workspace_id=data["prefect_workspace"]["prd"]["id"],
        paused=False,
        base_job_template=worker_metadata.base_job_configs.kubernetes)
    ecs = prefect.WorkPool("ecs",
        type="ecs",
        workspace_id=data["prefect_workspace"]["prd"]["id"],
        paused=False,
        base_job_template=worker_metadata.base_job_configs.ecs)
    process = prefect.WorkPool("process",
        type="cloud-run:push",
        workspace_id=data["prefect_workspace"]["prd"]["id"],
        paused=False,
        base_job_template=worker_metadata.base_job_configs.cloud_run_push)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/prefect/v2/prefect"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		workerMetadata, err := prefect.GetWorkerMetadata(ctx, &prefect.GetWorkerMetadataArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = prefect.NewWorkPool(ctx, "kubernetes", &prefect.WorkPoolArgs{
    			Type:            pulumi.String("kubernetes"),
    			WorkspaceId:     pulumi.Any(data.Prefect_workspace.Prd.Id),
    			Paused:          pulumi.Bool(false),
    			BaseJobTemplate: pulumi.String(workerMetadata.BaseJobConfigs.Kubernetes),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = prefect.NewWorkPool(ctx, "ecs", &prefect.WorkPoolArgs{
    			Type:            pulumi.String("ecs"),
    			WorkspaceId:     pulumi.Any(data.Prefect_workspace.Prd.Id),
    			Paused:          pulumi.Bool(false),
    			BaseJobTemplate: pulumi.String(workerMetadata.BaseJobConfigs.Ecs),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = prefect.NewWorkPool(ctx, "process", &prefect.WorkPoolArgs{
    			Type:            pulumi.String("cloud-run:push"),
    			WorkspaceId:     pulumi.Any(data.Prefect_workspace.Prd.Id),
    			Paused:          pulumi.Bool(false),
    			BaseJobTemplate: pulumi.String(workerMetadata.BaseJobConfigs.CloudRunPush),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Prefect = Pulumi.Prefect;
    
    return await Deployment.RunAsync(() => 
    {
        var workerMetadata = Prefect.GetWorkerMetadata.Invoke();
    
        var kubernetes = new Prefect.WorkPool("kubernetes", new()
        {
            Type = "kubernetes",
            WorkspaceId = data.Prefect_workspace.Prd.Id,
            Paused = false,
            BaseJobTemplate = workerMetadata.Apply(getWorkerMetadataResult => getWorkerMetadataResult.BaseJobConfigs?.Kubernetes),
        });
    
        var ecs = new Prefect.WorkPool("ecs", new()
        {
            Type = "ecs",
            WorkspaceId = data.Prefect_workspace.Prd.Id,
            Paused = false,
            BaseJobTemplate = workerMetadata.Apply(getWorkerMetadataResult => getWorkerMetadataResult.BaseJobConfigs?.Ecs),
        });
    
        var process = new Prefect.WorkPool("process", new()
        {
            Type = "cloud-run:push",
            WorkspaceId = data.Prefect_workspace.Prd.Id,
            Paused = false,
            BaseJobTemplate = workerMetadata.Apply(getWorkerMetadataResult => getWorkerMetadataResult.BaseJobConfigs?.CloudRunPush),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.prefect.PrefectFunctions;
    import com.pulumi.prefect.inputs.GetWorkerMetadataArgs;
    import com.pulumi.prefect.WorkPool;
    import com.pulumi.prefect.WorkPoolArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var workerMetadata = PrefectFunctions.getWorkerMetadata();
    
            var kubernetes = new WorkPool("kubernetes", WorkPoolArgs.builder()
                .type("kubernetes")
                .workspaceId(data.prefect_workspace().prd().id())
                .paused(false)
                .baseJobTemplate(workerMetadata.applyValue(getWorkerMetadataResult -> getWorkerMetadataResult.baseJobConfigs().kubernetes()))
                .build());
    
            var ecs = new WorkPool("ecs", WorkPoolArgs.builder()
                .type("ecs")
                .workspaceId(data.prefect_workspace().prd().id())
                .paused(false)
                .baseJobTemplate(workerMetadata.applyValue(getWorkerMetadataResult -> getWorkerMetadataResult.baseJobConfigs().ecs()))
                .build());
    
            var process = new WorkPool("process", WorkPoolArgs.builder()
                .type("cloud-run:push")
                .workspaceId(data.prefect_workspace().prd().id())
                .paused(false)
                .baseJobTemplate(workerMetadata.applyValue(getWorkerMetadataResult -> getWorkerMetadataResult.baseJobConfigs().cloudRunPush()))
                .build());
    
        }
    }
    
    resources:
      kubernetes:
        type: prefect:WorkPool
        properties:
          type: kubernetes
          workspaceId: ${data.prefect_workspace.prd.id}
          paused: false
          baseJobTemplate: ${workerMetadata.baseJobConfigs.kubernetes}
      ecs:
        type: prefect:WorkPool
        properties:
          type: ecs
          workspaceId: ${data.prefect_workspace.prd.id}
          paused: false
          baseJobTemplate: ${workerMetadata.baseJobConfigs.ecs}
      process:
        type: prefect:WorkPool
        properties:
          type: cloud-run:push
          workspaceId: ${data.prefect_workspace.prd.id}
          paused: false
          baseJobTemplate: ${workerMetadata.baseJobConfigs.cloudRunPush}
    variables:
      workerMetadata:
        fn::invoke:
          function: prefect:getWorkerMetadata
          arguments: {}
    

    Using getWorkerMetadata

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getWorkerMetadata(args: GetWorkerMetadataArgs, opts?: InvokeOptions): Promise<GetWorkerMetadataResult>
    function getWorkerMetadataOutput(args: GetWorkerMetadataOutputArgs, opts?: InvokeOptions): Output<GetWorkerMetadataResult>
    def get_worker_metadata(account_id: Optional[str] = None,
                            workspace_id: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetWorkerMetadataResult
    def get_worker_metadata_output(account_id: Optional[pulumi.Input[str]] = None,
                            workspace_id: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetWorkerMetadataResult]
    func GetWorkerMetadata(ctx *Context, args *GetWorkerMetadataArgs, opts ...InvokeOption) (*GetWorkerMetadataResult, error)
    func GetWorkerMetadataOutput(ctx *Context, args *GetWorkerMetadataOutputArgs, opts ...InvokeOption) GetWorkerMetadataResultOutput

    > Note: This function is named GetWorkerMetadata in the Go SDK.

    public static class GetWorkerMetadata 
    {
        public static Task<GetWorkerMetadataResult> InvokeAsync(GetWorkerMetadataArgs args, InvokeOptions? opts = null)
        public static Output<GetWorkerMetadataResult> Invoke(GetWorkerMetadataInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetWorkerMetadataResult> getWorkerMetadata(GetWorkerMetadataArgs args, InvokeOptions options)
    public static Output<GetWorkerMetadataResult> getWorkerMetadata(GetWorkerMetadataArgs args, InvokeOptions options)
    
    fn::invoke:
      function: prefect:index/getWorkerMetadata:getWorkerMetadata
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AccountId string
    Account ID (UUID), defaults to the account set in the provider
    WorkspaceId string
    Workspace ID (UUID), defaults to the workspace set in the provider
    AccountId string
    Account ID (UUID), defaults to the account set in the provider
    WorkspaceId string
    Workspace ID (UUID), defaults to the workspace set in the provider
    accountId String
    Account ID (UUID), defaults to the account set in the provider
    workspaceId String
    Workspace ID (UUID), defaults to the workspace set in the provider
    accountId string
    Account ID (UUID), defaults to the account set in the provider
    workspaceId string
    Workspace ID (UUID), defaults to the workspace set in the provider
    account_id str
    Account ID (UUID), defaults to the account set in the provider
    workspace_id str
    Workspace ID (UUID), defaults to the workspace set in the provider
    accountId String
    Account ID (UUID), defaults to the account set in the provider
    workspaceId String
    Workspace ID (UUID), defaults to the workspace set in the provider

    getWorkerMetadata Result

    The following output properties are available:

    BaseJobConfigs GetWorkerMetadataBaseJobConfigs
    A map of default base job configurations (JSON) for each of the primary worker types
    Id string
    The provider-assigned unique ID for this managed resource.
    AccountId string
    Account ID (UUID), defaults to the account set in the provider
    WorkspaceId string
    Workspace ID (UUID), defaults to the workspace set in the provider
    BaseJobConfigs GetWorkerMetadataBaseJobConfigs
    A map of default base job configurations (JSON) for each of the primary worker types
    Id string
    The provider-assigned unique ID for this managed resource.
    AccountId string
    Account ID (UUID), defaults to the account set in the provider
    WorkspaceId string
    Workspace ID (UUID), defaults to the workspace set in the provider
    baseJobConfigs GetWorkerMetadataBaseJobConfigs
    A map of default base job configurations (JSON) for each of the primary worker types
    id String
    The provider-assigned unique ID for this managed resource.
    accountId String
    Account ID (UUID), defaults to the account set in the provider
    workspaceId String
    Workspace ID (UUID), defaults to the workspace set in the provider
    baseJobConfigs GetWorkerMetadataBaseJobConfigs
    A map of default base job configurations (JSON) for each of the primary worker types
    id string
    The provider-assigned unique ID for this managed resource.
    accountId string
    Account ID (UUID), defaults to the account set in the provider
    workspaceId string
    Workspace ID (UUID), defaults to the workspace set in the provider
    base_job_configs GetWorkerMetadataBaseJobConfigs
    A map of default base job configurations (JSON) for each of the primary worker types
    id str
    The provider-assigned unique ID for this managed resource.
    account_id str
    Account ID (UUID), defaults to the account set in the provider
    workspace_id str
    Workspace ID (UUID), defaults to the workspace set in the provider
    baseJobConfigs Property Map
    A map of default base job configurations (JSON) for each of the primary worker types
    id String
    The provider-assigned unique ID for this managed resource.
    accountId String
    Account ID (UUID), defaults to the account set in the provider
    workspaceId String
    Workspace ID (UUID), defaults to the workspace set in the provider

    Supporting Types

    GetWorkerMetadataBaseJobConfigs

    AzureContainerInstances string
    Default base job configuration for Azure Container Instances workers
    AzureContainerInstancesPush string
    Default base job configuration for Azure Container Instances Push workers
    CloudRun string
    Default base job configuration for Cloud Run workers
    CloudRunPush string
    Default base job configuration for Cloud Run Push workers
    CloudRunV2 string
    Default base job configuration for Cloud Run V2 workers
    CloudRunV2Push string
    Default base job configuration for Cloud Run V2 Push workers
    Docker string
    Default base job configuration for Docker workers
    Ecs string
    Default base job configuration for ECS workers
    EcsPush string
    Default base job configuration for ECS Push workers
    Kubernetes string
    Default base job configuration for Kubernetes workers
    ModalPush string
    Default base job configuration for Modal Push workers
    PrefectAgent string
    Default base job configuration for Prefect Agent workers
    PrefectManaged string
    Default base job configuration for Prefect Managed workers
    Process string
    Default base job configuration for Process workers
    VertexAi string
    Default base job configuration for Vertex AI workers
    AzureContainerInstances string
    Default base job configuration for Azure Container Instances workers
    AzureContainerInstancesPush string
    Default base job configuration for Azure Container Instances Push workers
    CloudRun string
    Default base job configuration for Cloud Run workers
    CloudRunPush string
    Default base job configuration for Cloud Run Push workers
    CloudRunV2 string
    Default base job configuration for Cloud Run V2 workers
    CloudRunV2Push string
    Default base job configuration for Cloud Run V2 Push workers
    Docker string
    Default base job configuration for Docker workers
    Ecs string
    Default base job configuration for ECS workers
    EcsPush string
    Default base job configuration for ECS Push workers
    Kubernetes string
    Default base job configuration for Kubernetes workers
    ModalPush string
    Default base job configuration for Modal Push workers
    PrefectAgent string
    Default base job configuration for Prefect Agent workers
    PrefectManaged string
    Default base job configuration for Prefect Managed workers
    Process string
    Default base job configuration for Process workers
    VertexAi string
    Default base job configuration for Vertex AI workers
    azureContainerInstances String
    Default base job configuration for Azure Container Instances workers
    azureContainerInstancesPush String
    Default base job configuration for Azure Container Instances Push workers
    cloudRun String
    Default base job configuration for Cloud Run workers
    cloudRunPush String
    Default base job configuration for Cloud Run Push workers
    cloudRunV2 String
    Default base job configuration for Cloud Run V2 workers
    cloudRunV2Push String
    Default base job configuration for Cloud Run V2 Push workers
    docker String
    Default base job configuration for Docker workers
    ecs String
    Default base job configuration for ECS workers
    ecsPush String
    Default base job configuration for ECS Push workers
    kubernetes String
    Default base job configuration for Kubernetes workers
    modalPush String
    Default base job configuration for Modal Push workers
    prefectAgent String
    Default base job configuration for Prefect Agent workers
    prefectManaged String
    Default base job configuration for Prefect Managed workers
    process String
    Default base job configuration for Process workers
    vertexAi String
    Default base job configuration for Vertex AI workers
    azureContainerInstances string
    Default base job configuration for Azure Container Instances workers
    azureContainerInstancesPush string
    Default base job configuration for Azure Container Instances Push workers
    cloudRun string
    Default base job configuration for Cloud Run workers
    cloudRunPush string
    Default base job configuration for Cloud Run Push workers
    cloudRunV2 string
    Default base job configuration for Cloud Run V2 workers
    cloudRunV2Push string
    Default base job configuration for Cloud Run V2 Push workers
    docker string
    Default base job configuration for Docker workers
    ecs string
    Default base job configuration for ECS workers
    ecsPush string
    Default base job configuration for ECS Push workers
    kubernetes string
    Default base job configuration for Kubernetes workers
    modalPush string
    Default base job configuration for Modal Push workers
    prefectAgent string
    Default base job configuration for Prefect Agent workers
    prefectManaged string
    Default base job configuration for Prefect Managed workers
    process string
    Default base job configuration for Process workers
    vertexAi string
    Default base job configuration for Vertex AI workers
    azure_container_instances str
    Default base job configuration for Azure Container Instances workers
    azure_container_instances_push str
    Default base job configuration for Azure Container Instances Push workers
    cloud_run str
    Default base job configuration for Cloud Run workers
    cloud_run_push str
    Default base job configuration for Cloud Run Push workers
    cloud_run_v2 str
    Default base job configuration for Cloud Run V2 workers
    cloud_run_v2_push str
    Default base job configuration for Cloud Run V2 Push workers
    docker str
    Default base job configuration for Docker workers
    ecs str
    Default base job configuration for ECS workers
    ecs_push str
    Default base job configuration for ECS Push workers
    kubernetes str
    Default base job configuration for Kubernetes workers
    modal_push str
    Default base job configuration for Modal Push workers
    prefect_agent str
    Default base job configuration for Prefect Agent workers
    prefect_managed str
    Default base job configuration for Prefect Managed workers
    process str
    Default base job configuration for Process workers
    vertex_ai str
    Default base job configuration for Vertex AI workers
    azureContainerInstances String
    Default base job configuration for Azure Container Instances workers
    azureContainerInstancesPush String
    Default base job configuration for Azure Container Instances Push workers
    cloudRun String
    Default base job configuration for Cloud Run workers
    cloudRunPush String
    Default base job configuration for Cloud Run Push workers
    cloudRunV2 String
    Default base job configuration for Cloud Run V2 workers
    cloudRunV2Push String
    Default base job configuration for Cloud Run V2 Push workers
    docker String
    Default base job configuration for Docker workers
    ecs String
    Default base job configuration for ECS workers
    ecsPush String
    Default base job configuration for ECS Push workers
    kubernetes String
    Default base job configuration for Kubernetes workers
    modalPush String
    Default base job configuration for Modal Push workers
    prefectAgent String
    Default base job configuration for Prefect Agent workers
    prefectManaged String
    Default base job configuration for Prefect Managed workers
    process String
    Default base job configuration for Process workers
    vertexAi String
    Default base job configuration for Vertex AI workers

    Package Details

    Repository
    prefect prefecthq/terraform-provider-prefect
    License
    Notes
    This Pulumi package is based on the prefect Terraform Provider.
    prefect logo
    prefect 2.22.4 published on Wednesday, Mar 26, 2025 by prefecthq