# K6Resource

- Module: [CommunityToolkit.Aspire.Hosting.k6](/reference/api/go/communitytoolkit.aspire.hosting.k6.md)
- Version: `13.6.1`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

A resource that represents a Grafana k6 instance

## Definition

```go
type K6Resource interface {
    IComputeResource
    Resource
    ResourceWithArgs
    ResourceWithEndpoints
    ResourceWithEnvironment
    ResourceWithWaitSupport
}
```

## Embeds

- `IComputeResource`
- `Resource`
- `ResourceWithArgs`
- `ResourceWithEndpoints`
- `ResourceWithEnvironment`
- `ResourceWithWaitSupport`

## Properties

- `PrimaryEndpoint`: `EndpointReference` `get` -- Gets the primary endpoint for the Grafana k6 instance. This endpoint is used for all API calls over HTTP.

## Methods

- [WithK6OtlpEnvironment](/reference/api/go/communitytoolkit.aspire.hosting.k6/k6resource/withk6otlpenvironment.md) -- `method` -- Set K6 environment variables from the existing OTEL environment set for this resource. See https://grafana.com/docs/k6/latest/results-output/real-time/opentelemetry/#configuration.
  ```go
  WithK6OtlpEnvironment() K6Resource
  ```
- [WithScript](/reference/api/go/communitytoolkit.aspire.hosting.k6/k6resource/withscript.md) -- `method` -- Runs a k6 JS script when starting the Grafana k6 container resource.
  ```go
  WithScript(scriptPath string, options ...*WithScriptOptions) K6Resource
  ```
