1. Registry
  2. Packages
  3. Coder Provider
  4. API Docs
  5. getScriptOrder
Viewing docs for coder 2.20.0
published on Monday, Nov 2, 2026 by coder
coder
Viewing docs for coder 2.20.0
published on Monday, Nov 2, 2026 by coder

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as coder from "@pulumi/coder";
    
    const startupDependencies = coder.getScriptOrder({
        rules: [
            {
                runs: ["coder_script.install_tools"],
                afters: ["coder_script.clone_repo"],
            },
            {
                runs: ["coder_script.configure_workspace"],
                afters: ["module.bootstrap"],
                requires: "completion",
            },
            {
                runs: ["coder_script.archive_logs"],
                afters: ["module.cleanup"],
                phase: "stop",
            },
        ],
    });
    
    import pulumi
    import pulumi_coder as coder
    
    startup_dependencies = coder.get_script_order(rules=[
        {
            "runs": ["coder_script.install_tools"],
            "afters": ["coder_script.clone_repo"],
        },
        {
            "runs": ["coder_script.configure_workspace"],
            "afters": ["module.bootstrap"],
            "requires": "completion",
        },
        {
            "runs": ["coder_script.archive_logs"],
            "afters": ["module.cleanup"],
            "phase": "stop",
        },
    ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/coder/v2/coder"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := coder.GetScriptOrder(ctx, &coder.GetScriptOrderArgs{
    			Rules: []coder.GetScriptOrderRule{
    				{
    					Runs: []string{
    						"coder_script.install_tools",
    					},
    					Afters: []string{
    						"coder_script.clone_repo",
    					},
    				},
    				{
    					Runs: []string{
    						"coder_script.configure_workspace",
    					},
    					Afters: []string{
    						"module.bootstrap",
    					},
    					Requires: pulumi.StringRef("completion"),
    				},
    				{
    					Runs: []string{
    						"coder_script.archive_logs",
    					},
    					Afters: []string{
    						"module.cleanup",
    					},
    					Phase: pulumi.StringRef("stop"),
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Coder = Pulumi.Coder;
    
    return await Deployment.RunAsync(() => 
    {
        var startupDependencies = Coder.GetScriptOrder.Invoke(new()
        {
            Rules = new[]
            {
                new Coder.Inputs.GetScriptOrderRuleInputArgs
                {
                    Runs = new[]
                    {
                        "coder_script.install_tools",
                    },
                    Afters = new[]
                    {
                        "coder_script.clone_repo",
                    },
                },
                new Coder.Inputs.GetScriptOrderRuleInputArgs
                {
                    Runs = new[]
                    {
                        "coder_script.configure_workspace",
                    },
                    Afters = new[]
                    {
                        "module.bootstrap",
                    },
                    Requires = "completion",
                },
                new Coder.Inputs.GetScriptOrderRuleInputArgs
                {
                    Runs = new[]
                    {
                        "coder_script.archive_logs",
                    },
                    Afters = new[]
                    {
                        "module.cleanup",
                    },
                    Phase = "stop",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.coder.CoderFunctions;
    import com.pulumi.coder.inputs.GetScriptOrderArgs;
    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 startupDependencies = CoderFunctions.getScriptOrder(GetScriptOrderArgs.builder()
                .rules(            
                    GetScriptOrderRuleArgs.builder()
                        .runs("coder_script.install_tools")
                        .afters("coder_script.clone_repo")
                        .build(),
                    GetScriptOrderRuleArgs.builder()
                        .runs("coder_script.configure_workspace")
                        .afters("module.bootstrap")
                        .requires("completion")
                        .build(),
                    GetScriptOrderRuleArgs.builder()
                        .runs("coder_script.archive_logs")
                        .afters("module.cleanup")
                        .phase("stop")
                        .build())
                .build());
    
        }
    }
    
    variables:
      startupDependencies:
        fn::invoke:
          function: coder:getScriptOrder
          arguments:
            rules:
              - runs:
                  - coder_script.install_tools
                afters:
                  - coder_script.clone_repo
              - runs:
                  - coder_script.configure_workspace
                afters:
                  - module.bootstrap
                requires: completion
              - runs:
                  - coder_script.archive_logs
                afters:
                  - module.cleanup
                phase: stop
    
    Example coming soon!
    

    Using getScriptOrder

    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 getScriptOrder(args: GetScriptOrderArgs, opts?: InvokeOptions): Promise<GetScriptOrderResult>
    function getScriptOrderOutput(args: GetScriptOrderOutputArgs, opts?: InvokeOutputOptions): Output<GetScriptOrderResult>
    def get_script_order(id: Optional[str] = None,
                         rules: Optional[Sequence[GetScriptOrderRule]] = None,
                         opts: Optional[InvokeOptions] = None) -> GetScriptOrderResult
    def get_script_order_output(id: pulumi.Input[Optional[str]] = None,
                         rules: pulumi.Input[Optional[Sequence[pulumi.Input[GetScriptOrderRuleArgs]]]] = None,
                         opts: Optional[InvokeOutputOptions] = None) -> Output[GetScriptOrderResult]
    func GetScriptOrder(ctx *Context, args *GetScriptOrderArgs, opts ...InvokeOption) (*GetScriptOrderResult, error)
    func GetScriptOrderOutput(ctx *Context, args *GetScriptOrderOutputArgs, opts ...InvokeOption) GetScriptOrderResultOutput

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

    public static class GetScriptOrder 
    {
        public static Task<GetScriptOrderResult> InvokeAsync(GetScriptOrderArgs args, InvokeOptions? opts = null)
        public static Output<GetScriptOrderResult> Invoke(GetScriptOrderInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetScriptOrderResult> Invoke(GetScriptOrderInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetScriptOrderResult> getScriptOrder(GetScriptOrderArgs args, InvokeOptions options)
    public static Output<GetScriptOrderResult> getScriptOrder(GetScriptOrderArgs args, InvokeOptions options)
    public static Output<GetScriptOrderResult> getScriptOrder(GetScriptOrderArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: coder:index/getScriptOrder:getScriptOrder
      arguments:
        # arguments dictionary
    data "coder_get_script_order" "name" {
        # arguments
    }

    The following arguments are supported:

    Rules List<GetScriptOrderRule>
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    Id string
    The ID of this resource.
    Rules []GetScriptOrderRule
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    Id string
    The ID of this resource.
    rules list(object)
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id string
    The ID of this resource.
    rules List<GetScriptOrderRule>
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id String
    The ID of this resource.
    rules GetScriptOrderRule[]
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id string
    The ID of this resource.
    rules Sequence[GetScriptOrderRule]
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id str
    The ID of this resource.
    rules List<Property Map>
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id String
    The ID of this resource.

    getScriptOrder Result

    The following output properties are available:

    Id string
    The ID of this resource.
    Rules List<GetScriptOrderRule>
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    Id string
    The ID of this resource.
    Rules []GetScriptOrderRule
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id string
    The ID of this resource.
    rules list(object)
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id String
    The ID of this resource.
    rules List<GetScriptOrderRule>
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id string
    The ID of this resource.
    rules GetScriptOrderRule[]
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id str
    The ID of this resource.
    rules Sequence[GetScriptOrderRule]
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.
    id String
    The ID of this resource.
    rules List<Property Map>
    One or more ordering rules. Rules from every coder.getScriptOrder in the template are merged into one graph per agent.

    Supporting Types

    GetScriptOrderRule

    Afters List<string>
    Selectors for the scripts that must finish before any run script starts.
    Runs List<string>
    Selectors for the scripts that wait for every after script.
    Phase string
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    Requires string
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.
    Afters []string
    Selectors for the scripts that must finish before any run script starts.
    Runs []string
    Selectors for the scripts that wait for every after script.
    Phase string
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    Requires string
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.
    afters list(string)
    Selectors for the scripts that must finish before any run script starts.
    runs list(string)
    Selectors for the scripts that wait for every after script.
    phase string
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    requires string
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.
    afters List<String>
    Selectors for the scripts that must finish before any run script starts.
    runs List<String>
    Selectors for the scripts that wait for every after script.
    phase String
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    requires String
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.
    afters string[]
    Selectors for the scripts that must finish before any run script starts.
    runs string[]
    Selectors for the scripts that wait for every after script.
    phase string
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    requires string
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.
    afters Sequence[str]
    Selectors for the scripts that must finish before any run script starts.
    runs Sequence[str]
    Selectors for the scripts that wait for every after script.
    phase str
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    requires str
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.
    afters List<String>
    Selectors for the scripts that must finish before any run script starts.
    runs List<String>
    Selectors for the scripts that wait for every after script.
    phase String
    Which lifecycle the rule applies to: start or stop. When omitted, Coder infers the phase from any coder.Script selector in the rule and filters module selectors to that phase with a warning. If the rule has only module selectors and they expand to both start and stop scripts, Coder cannot infer the phase and rejects the rule at template import, so set phase explicitly in that case.
    requires String
    The outcome required from every after script before a run script starts. success (the default) skips the run scripts if any after script fails, times out or is skipped. completion runs them once every after script has finished, whatever the outcome.

    Package Details

    Repository
    coder coder/terraform-provider-coder
    License
    Notes
    This Pulumi package is based on the coder Terraform Provider.
    coder
    Viewing docs for coder 2.20.0
    published on Monday, Nov 2, 2026 by coder

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial