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

grafana.k6.LoadTest

Explore with Pulumi AI

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

    Manages 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!');
    }
    `,
    });
    
    import pulumi
    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!');
    }
    """)
    
    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
    		}
    		_, 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
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    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!');
    }
    ",
        });
    
    });
    
    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 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());
    
        }
    }
    
    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!');
            }        
    

    Create LoadTest Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new LoadTest(name: string, args: LoadTestArgs, opts?: CustomResourceOptions);
    @overload
    def LoadTest(resource_name: str,
                 args: LoadTestArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def LoadTest(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 project_id: Optional[str] = None,
                 script: Optional[str] = None,
                 baseline_test_run_id: Optional[str] = None,
                 name: Optional[str] = None)
    func NewLoadTest(ctx *Context, name string, args LoadTestArgs, opts ...ResourceOption) (*LoadTest, error)
    public LoadTest(string name, LoadTestArgs args, CustomResourceOptions? opts = null)
    public LoadTest(String name, LoadTestArgs args)
    public LoadTest(String name, LoadTestArgs args, CustomResourceOptions options)
    
    type: grafana:k6:LoadTest
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args LoadTestArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args LoadTestArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args LoadTestArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LoadTestArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LoadTestArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var loadTestResource = new Grafana.K6.LoadTest("loadTestResource", new()
    {
        ProjectId = "string",
        Script = "string",
        BaselineTestRunId = "string",
        Name = "string",
    });
    
    example, err := k6.NewLoadTest(ctx, "loadTestResource", &k6.LoadTestArgs{
    	ProjectId:         pulumi.String("string"),
    	Script:            pulumi.String("string"),
    	BaselineTestRunId: pulumi.String("string"),
    	Name:              pulumi.String("string"),
    })
    
    var loadTestResource = new LoadTest("loadTestResource", LoadTestArgs.builder()
        .projectId("string")
        .script("string")
        .baselineTestRunId("string")
        .name("string")
        .build());
    
    load_test_resource = grafana.k6.LoadTest("loadTestResource",
        project_id="string",
        script="string",
        baseline_test_run_id="string",
        name="string")
    
    const loadTestResource = new grafana.k6.LoadTest("loadTestResource", {
        projectId: "string",
        script: "string",
        baselineTestRunId: "string",
        name: "string",
    });
    
    type: grafana:k6:LoadTest
    properties:
        baselineTestRunId: string
        name: string
        projectId: string
        script: string
    

    LoadTest Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The LoadTest resource accepts the following input properties:

    ProjectId string
    The identifier of the project this load test belongs to.
    Script string
    The k6 test script content. Can be provided inline or via the file() function.
    BaselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    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. Can be provided inline or via the file() function.
    BaselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    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. Can be provided inline or via the file() function.
    baselineTestRunId String
    Identifier of a baseline test run used for results comparison.
    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. Can be provided inline or via the file() function.
    baselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    name string
    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. Can be provided inline or via the file() function.
    baseline_test_run_id str
    Identifier of a baseline test run used for results comparison.
    name str
    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. Can be provided inline or via the file() function.
    baselineTestRunId String
    Identifier of a baseline test run used for results comparison.
    name String
    Human-friendly identifier of the load test.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the LoadTest resource produces the following output properties:

    Created string
    The date when the load test was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Updated string
    The date when the load test was last updated.
    Created string
    The date when the load test was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Updated string
    The date when the load test was last updated.
    created String
    The date when the load test was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updated String
    The date when the load test was last updated.
    created string
    The date when the load test was created.
    id string
    The provider-assigned unique ID for this managed resource.
    updated string
    The date when the load test was last updated.
    created str
    The date when the load test was created.
    id str
    The provider-assigned unique ID for this managed resource.
    updated str
    The date when the load test was last updated.
    created String
    The date when the load test was created.
    id String
    The provider-assigned unique ID for this managed resource.
    updated String
    The date when the load test was last updated.

    Look up Existing LoadTest Resource

    Get an existing LoadTest resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: LoadTestState, opts?: CustomResourceOptions): LoadTest
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            baseline_test_run_id: Optional[str] = None,
            created: Optional[str] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None,
            script: Optional[str] = None,
            updated: Optional[str] = None) -> LoadTest
    func GetLoadTest(ctx *Context, name string, id IDInput, state *LoadTestState, opts ...ResourceOption) (*LoadTest, error)
    public static LoadTest Get(string name, Input<string> id, LoadTestState? state, CustomResourceOptions? opts = null)
    public static LoadTest get(String name, Output<String> id, LoadTestState state, CustomResourceOptions options)
    resources:  _:    type: grafana:k6:LoadTest    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BaselineTestRunId string
    Identifier of a baseline test run used for results comparison.
    Created string
    The date when the load test was created.
    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. Can be provided inline or via the file() function.
    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.
    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. Can be provided inline or via the file() function.
    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.
    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. Can be provided inline or via the file() function.
    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.
    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. Can be provided inline or via the file() function.
    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.
    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. Can be provided inline or via the file() function.
    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.
    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. Can be provided inline or via the file() function.
    updated String
    The date when the load test was last updated.

    Import

    $ pulumi import grafana:k6/loadTest:LoadTest name "{{ id }}"
    

    To learn more about importing existing cloud resources, see Importing resources.

    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