1. Packages
  2. Grafana Cloud
  3. API Docs
  4. k6
  5. getLoadTest
Grafana v0.19.2 published on Friday, Jul 18, 2025 by pulumiverse

grafana.k6.getLoadTest

Explore with Pulumi AI

grafana logo
Grafana v0.19.2 published on Friday, Jul 18, 2025 by pulumiverse

    Retrieves a k6 load test.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const loadTestProject = new grafana.k6.Project("load_test_project", {name: "Terraform Load Test Project"});
    const testLoadTest = new grafana.k6.LoadTest("test_load_test", {
        projectId: loadTestProject.id,
        name: "Terraform Test Load Test",
        script: `export default function() {
      console.log('Hello from k6!');
    }
    `,
    });
    const fromId = grafana.k6.getLoadTestOutput({
        id: testLoadTest.id,
    });
    
    import pulumi
    import pulumi_grafana as grafana
    import pulumiverse_grafana as grafana
    
    load_test_project = grafana.k6.Project("load_test_project", name="Terraform Load Test Project")
    test_load_test = grafana.k6.LoadTest("test_load_test",
        project_id=load_test_project.id,
        name="Terraform Test Load Test",
        script="""export default function() {
      console.log('Hello from k6!');
    }
    """)
    from_id = grafana.k6.get_load_test_output(id=test_load_test.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/k6"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		loadTestProject, err := k6.NewProject(ctx, "load_test_project", &k6.ProjectArgs{
    			Name: pulumi.String("Terraform Load Test Project"),
    		})
    		if err != nil {
    			return err
    		}
    		testLoadTest, err := k6.NewLoadTest(ctx, "test_load_test", &k6.LoadTestArgs{
    			ProjectId: loadTestProject.ID(),
    			Name:      pulumi.String("Terraform Test Load Test"),
    			Script:    pulumi.String("export default function() {\n  console.log('Hello from k6!');\n}\n"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = k6.LookupLoadTestOutput(ctx, k6.GetLoadTestOutputArgs{
    			Id: testLoadTest.ID(),
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumi.Grafana;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var loadTestProject = new Grafana.K6.Project("load_test_project", new()
        {
            Name = "Terraform Load Test Project",
        });
    
        var testLoadTest = new Grafana.K6.LoadTest("test_load_test", new()
        {
            ProjectId = loadTestProject.Id,
            Name = "Terraform Test Load Test",
            Script = @"export default function() {
      console.log('Hello from k6!');
    }
    ",
        });
    
        var fromId = Grafana.K6.GetLoadTest.Invoke(new()
        {
            Id = testLoadTest.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.k6.Project;
    import com.pulumi.grafana.k6.ProjectArgs;
    import com.pulumi.grafana.k6.LoadTest;
    import com.pulumi.grafana.k6.LoadTestArgs;
    import com.pulumi.grafana.k6.K6Functions;
    import com.pulumi.grafana.k6.inputs.GetLoadTestArgs;
    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) {
            var loadTestProject = new Project("loadTestProject", ProjectArgs.builder()
                .name("Terraform Load Test Project")
                .build());
    
            var testLoadTest = new LoadTest("testLoadTest", LoadTestArgs.builder()
                .projectId(loadTestProject.id())
                .name("Terraform Test Load Test")
                .script("""
    export default function() {
      console.log('Hello from k6!');
    }
                """)
                .build());
    
            final var fromId = K6Functions.getLoadTest(GetLoadTestArgs.builder()
                .id(testLoadTest.id())
                .build());
    
        }
    }
    
    resources:
      loadTestProject:
        type: grafana:k6:Project
        name: load_test_project
        properties:
          name: Terraform Load Test Project
      testLoadTest:
        type: grafana:k6:LoadTest
        name: test_load_test
        properties:
          projectId: ${loadTestProject.id}
          name: Terraform Test Load Test
          script: |
            export default function() {
              console.log('Hello from k6!');
            }        
    variables:
      fromId:
        fn::invoke:
          function: grafana:k6:getLoadTest
          arguments:
            id: ${testLoadTest.id}
    

    Using getLoadTest

    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 getLoadTest(args: GetLoadTestArgs, opts?: InvokeOptions): Promise<GetLoadTestResult>
    function getLoadTestOutput(args: GetLoadTestOutputArgs, opts?: InvokeOptions): Output<GetLoadTestResult>
    def get_load_test(id: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetLoadTestResult
    def get_load_test_output(id: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetLoadTestResult]
    func LookupLoadTest(ctx *Context, args *LookupLoadTestArgs, opts ...InvokeOption) (*LookupLoadTestResult, error)
    func LookupLoadTestOutput(ctx *Context, args *LookupLoadTestOutputArgs, opts ...InvokeOption) LookupLoadTestResultOutput

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

    public static class GetLoadTest 
    {
        public static Task<GetLoadTestResult> InvokeAsync(GetLoadTestArgs args, InvokeOptions? opts = null)
        public static Output<GetLoadTestResult> Invoke(GetLoadTestInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLoadTestResult> getLoadTest(GetLoadTestArgs args, InvokeOptions options)
    public static Output<GetLoadTestResult> getLoadTest(GetLoadTestArgs args, InvokeOptions options)
    
    fn::invoke:
      function: grafana:k6/getLoadTest:getLoadTest
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    Numeric identifier of the load test.
    Id string
    Numeric identifier of the load test.
    id String
    Numeric identifier of the load test.
    id string
    Numeric identifier of the load test.
    id str
    Numeric identifier of the load test.
    id String
    Numeric identifier of the load test.

    getLoadTest Result

    The following output properties are available:

    BaselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    Created string
    The date when the load test was created.
    Id string
    Numeric identifier of the load test.
    Name string
    Human-friendly identifier of the load test.
    ProjectId string
    The identifier of the project this load test belongs to.
    Script string
    The k6 test script content.
    Updated string
    The date when the load test was last updated.
    BaselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    Created string
    The date when the load test was created.
    Id string
    Numeric identifier of the load test.
    Name string
    Human-friendly identifier of the load test.
    ProjectId string
    The identifier of the project this load test belongs to.
    Script string
    The k6 test script content.
    Updated string
    The date when the load test was last updated.
    baselineTestRunId String
    Identifier of a baseline test run used for results comparison.
    created String
    The date when the load test was created.
    id String
    Numeric identifier of the load test.
    name String
    Human-friendly identifier of the load test.
    projectId String
    The identifier of the project this load test belongs to.
    script String
    The k6 test script content.
    updated String
    The date when the load test was last updated.
    baselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    created string
    The date when the load test was created.
    id string
    Numeric identifier of the load test.
    name string
    Human-friendly identifier of the load test.
    projectId string
    The identifier of the project this load test belongs to.
    script string
    The k6 test script content.
    updated string
    The date when the load test was last updated.
    baseline_test_run_id str
    Identifier of a baseline test run used for results comparison.
    created str
    The date when the load test was created.
    id str
    Numeric identifier of the load test.
    name str
    Human-friendly identifier of the load test.
    project_id str
    The identifier of the project this load test belongs to.
    script str
    The k6 test script content.
    updated str
    The date when the load test was last updated.
    baselineTestRunId String
    Identifier of a baseline test run used for results comparison.
    created String
    The date when the load test was created.
    id String
    Numeric identifier of the load test.
    name String
    Human-friendly identifier of the load test.
    projectId String
    The identifier of the project this load test belongs to.
    script String
    The k6 test script content.
    updated String
    The date when the load test was last updated.

    Package Details

    Repository
    grafana pulumiverse/pulumi-grafana
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the grafana Terraform Provider.
    grafana logo
    Grafana v0.19.2 published on Friday, Jul 18, 2025 by pulumiverse