1. Packages
  2. Grafana Cloud
  3. API Docs
  4. oss
  5. ServiceAccountRotatingToken
Grafana v2.18.0 published on Wednesday, Dec 3, 2025 by pulumiverse
grafana logo
Grafana v2.18.0 published on Wednesday, Dec 3, 2025 by pulumiverse

    Note: This resource is available only with Grafana 9.1+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const test = new grafana.oss.ServiceAccount("test", {
        name: "test-service-account",
        role: "Viewer",
    });
    const foo = new grafana.oss.ServiceAccountRotatingToken("foo", {
        namePrefix: "key_foo",
        serviceAccountId: test.id,
        secondsToLive: 7776000,
        earlyRotationWindowSeconds: 604800,
    });
    export const serviceAccountTokenFooKey = foo.key;
    
    import pulumi
    import pulumiverse_grafana as grafana
    
    test = grafana.oss.ServiceAccount("test",
        name="test-service-account",
        role="Viewer")
    foo = grafana.oss.ServiceAccountRotatingToken("foo",
        name_prefix="key_foo",
        service_account_id=test.id,
        seconds_to_live=7776000,
        early_rotation_window_seconds=604800)
    pulumi.export("serviceAccountTokenFooKey", foo.key)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/v2/go/grafana/oss"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := oss.NewServiceAccount(ctx, "test", &oss.ServiceAccountArgs{
    			Name: pulumi.String("test-service-account"),
    			Role: pulumi.String("Viewer"),
    		})
    		if err != nil {
    			return err
    		}
    		foo, err := oss.NewServiceAccountRotatingToken(ctx, "foo", &oss.ServiceAccountRotatingTokenArgs{
    			NamePrefix:                 pulumi.String("key_foo"),
    			ServiceAccountId:           test.ID(),
    			SecondsToLive:              pulumi.Int(7776000),
    			EarlyRotationWindowSeconds: pulumi.Int(604800),
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("serviceAccountTokenFooKey", foo.Key)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Grafana.Oss.ServiceAccount("test", new()
        {
            Name = "test-service-account",
            Role = "Viewer",
        });
    
        var foo = new Grafana.Oss.ServiceAccountRotatingToken("foo", new()
        {
            NamePrefix = "key_foo",
            ServiceAccountId = test.Id,
            SecondsToLive = 7776000,
            EarlyRotationWindowSeconds = 604800,
        });
    
        return new Dictionary<string, object?>
        {
            ["serviceAccountTokenFooKey"] = foo.Key,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.oss.ServiceAccount;
    import com.pulumi.grafana.oss.ServiceAccountArgs;
    import com.pulumi.grafana.oss.ServiceAccountRotatingToken;
    import com.pulumi.grafana.oss.ServiceAccountRotatingTokenArgs;
    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 test = new ServiceAccount("test", ServiceAccountArgs.builder()
                .name("test-service-account")
                .role("Viewer")
                .build());
    
            var foo = new ServiceAccountRotatingToken("foo", ServiceAccountRotatingTokenArgs.builder()
                .namePrefix("key_foo")
                .serviceAccountId(test.id())
                .secondsToLive(7776000)
                .earlyRotationWindowSeconds(604800)
                .build());
    
            ctx.export("serviceAccountTokenFooKey", foo.key());
        }
    }
    
    resources:
      test:
        type: grafana:oss:ServiceAccount
        properties:
          name: test-service-account
          role: Viewer
      foo:
        type: grafana:oss:ServiceAccountRotatingToken
        properties:
          namePrefix: key_foo
          serviceAccountId: ${test.id}
          secondsToLive: 7.776e+06 # 3 months
          earlyRotationWindowSeconds: 604800 # 1 week
    outputs:
      serviceAccountTokenFooKey: ${foo.key}
    

    Create ServiceAccountRotatingToken Resource

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

    Constructor syntax

    new ServiceAccountRotatingToken(name: string, args: ServiceAccountRotatingTokenArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceAccountRotatingToken(resource_name: str,
                                    args: ServiceAccountRotatingTokenArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceAccountRotatingToken(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    early_rotation_window_seconds: Optional[int] = None,
                                    name_prefix: Optional[str] = None,
                                    seconds_to_live: Optional[int] = None,
                                    service_account_id: Optional[str] = None,
                                    delete_on_destroy: Optional[bool] = None)
    func NewServiceAccountRotatingToken(ctx *Context, name string, args ServiceAccountRotatingTokenArgs, opts ...ResourceOption) (*ServiceAccountRotatingToken, error)
    public ServiceAccountRotatingToken(string name, ServiceAccountRotatingTokenArgs args, CustomResourceOptions? opts = null)
    public ServiceAccountRotatingToken(String name, ServiceAccountRotatingTokenArgs args)
    public ServiceAccountRotatingToken(String name, ServiceAccountRotatingTokenArgs args, CustomResourceOptions options)
    
    type: grafana:oss:ServiceAccountRotatingToken
    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 ServiceAccountRotatingTokenArgs
    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 ServiceAccountRotatingTokenArgs
    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 ServiceAccountRotatingTokenArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceAccountRotatingTokenArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceAccountRotatingTokenArgs
    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 serviceAccountRotatingTokenResource = new Grafana.Oss.ServiceAccountRotatingToken("serviceAccountRotatingTokenResource", new()
    {
        EarlyRotationWindowSeconds = 0,
        NamePrefix = "string",
        SecondsToLive = 0,
        ServiceAccountId = "string",
        DeleteOnDestroy = false,
    });
    
    example, err := oss.NewServiceAccountRotatingToken(ctx, "serviceAccountRotatingTokenResource", &oss.ServiceAccountRotatingTokenArgs{
    	EarlyRotationWindowSeconds: pulumi.Int(0),
    	NamePrefix:                 pulumi.String("string"),
    	SecondsToLive:              pulumi.Int(0),
    	ServiceAccountId:           pulumi.String("string"),
    	DeleteOnDestroy:            pulumi.Bool(false),
    })
    
    var serviceAccountRotatingTokenResource = new ServiceAccountRotatingToken("serviceAccountRotatingTokenResource", ServiceAccountRotatingTokenArgs.builder()
        .earlyRotationWindowSeconds(0)
        .namePrefix("string")
        .secondsToLive(0)
        .serviceAccountId("string")
        .deleteOnDestroy(false)
        .build());
    
    service_account_rotating_token_resource = grafana.oss.ServiceAccountRotatingToken("serviceAccountRotatingTokenResource",
        early_rotation_window_seconds=0,
        name_prefix="string",
        seconds_to_live=0,
        service_account_id="string",
        delete_on_destroy=False)
    
    const serviceAccountRotatingTokenResource = new grafana.oss.ServiceAccountRotatingToken("serviceAccountRotatingTokenResource", {
        earlyRotationWindowSeconds: 0,
        namePrefix: "string",
        secondsToLive: 0,
        serviceAccountId: "string",
        deleteOnDestroy: false,
    });
    
    type: grafana:oss:ServiceAccountRotatingToken
    properties:
        deleteOnDestroy: false
        earlyRotationWindowSeconds: 0
        namePrefix: string
        secondsToLive: 0
        serviceAccountId: string
    

    ServiceAccountRotatingToken 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 ServiceAccountRotatingToken resource accepts the following input properties:

    EarlyRotationWindowSeconds int
    Duration of the time window before expiring where the token can be rotated, in seconds.
    NamePrefix string
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    SecondsToLive int
    The token expiration in seconds.
    ServiceAccountId string
    The ID of the service account to which the token belongs.
    DeleteOnDestroy bool
    EarlyRotationWindowSeconds int
    Duration of the time window before expiring where the token can be rotated, in seconds.
    NamePrefix string
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    SecondsToLive int
    The token expiration in seconds.
    ServiceAccountId string
    The ID of the service account to which the token belongs.
    DeleteOnDestroy bool
    earlyRotationWindowSeconds Integer
    Duration of the time window before expiring where the token can be rotated, in seconds.
    namePrefix String
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    secondsToLive Integer
    The token expiration in seconds.
    serviceAccountId String
    The ID of the service account to which the token belongs.
    deleteOnDestroy Boolean
    earlyRotationWindowSeconds number
    Duration of the time window before expiring where the token can be rotated, in seconds.
    namePrefix string
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    secondsToLive number
    The token expiration in seconds.
    serviceAccountId string
    The ID of the service account to which the token belongs.
    deleteOnDestroy boolean
    early_rotation_window_seconds int
    Duration of the time window before expiring where the token can be rotated, in seconds.
    name_prefix str
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    seconds_to_live int
    The token expiration in seconds.
    service_account_id str
    The ID of the service account to which the token belongs.
    delete_on_destroy bool
    earlyRotationWindowSeconds Number
    Duration of the time window before expiring where the token can be rotated, in seconds.
    namePrefix String
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    secondsToLive Number
    The token expiration in seconds.
    serviceAccountId String
    The ID of the service account to which the token belongs.
    deleteOnDestroy Boolean

    Outputs

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

    Expiration string
    The expiration date of the service account token.
    HasExpired bool
    The status of the service account token.
    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The key of the service account token.
    Name string
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    ReadyForRotation bool
    Signals that the service account token is expired or within the period to be early rotated.
    Expiration string
    The expiration date of the service account token.
    HasExpired bool
    The status of the service account token.
    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The key of the service account token.
    Name string
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    ReadyForRotation bool
    Signals that the service account token is expired or within the period to be early rotated.
    expiration String
    The expiration date of the service account token.
    hasExpired Boolean
    The status of the service account token.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The key of the service account token.
    name String
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    readyForRotation Boolean
    Signals that the service account token is expired or within the period to be early rotated.
    expiration string
    The expiration date of the service account token.
    hasExpired boolean
    The status of the service account token.
    id string
    The provider-assigned unique ID for this managed resource.
    key string
    The key of the service account token.
    name string
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    readyForRotation boolean
    Signals that the service account token is expired or within the period to be early rotated.
    expiration str
    The expiration date of the service account token.
    has_expired bool
    The status of the service account token.
    id str
    The provider-assigned unique ID for this managed resource.
    key str
    The key of the service account token.
    name str
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    ready_for_rotation bool
    Signals that the service account token is expired or within the period to be early rotated.
    expiration String
    The expiration date of the service account token.
    hasExpired Boolean
    The status of the service account token.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The key of the service account token.
    name String
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    readyForRotation Boolean
    Signals that the service account token is expired or within the period to be early rotated.

    Look up Existing ServiceAccountRotatingToken Resource

    Get an existing ServiceAccountRotatingToken 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?: ServiceAccountRotatingTokenState, opts?: CustomResourceOptions): ServiceAccountRotatingToken
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            delete_on_destroy: Optional[bool] = None,
            early_rotation_window_seconds: Optional[int] = None,
            expiration: Optional[str] = None,
            has_expired: Optional[bool] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            name_prefix: Optional[str] = None,
            ready_for_rotation: Optional[bool] = None,
            seconds_to_live: Optional[int] = None,
            service_account_id: Optional[str] = None) -> ServiceAccountRotatingToken
    func GetServiceAccountRotatingToken(ctx *Context, name string, id IDInput, state *ServiceAccountRotatingTokenState, opts ...ResourceOption) (*ServiceAccountRotatingToken, error)
    public static ServiceAccountRotatingToken Get(string name, Input<string> id, ServiceAccountRotatingTokenState? state, CustomResourceOptions? opts = null)
    public static ServiceAccountRotatingToken get(String name, Output<String> id, ServiceAccountRotatingTokenState state, CustomResourceOptions options)
    resources:  _:    type: grafana:oss:ServiceAccountRotatingToken    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:
    DeleteOnDestroy bool
    EarlyRotationWindowSeconds int
    Duration of the time window before expiring where the token can be rotated, in seconds.
    Expiration string
    The expiration date of the service account token.
    HasExpired bool
    The status of the service account token.
    Key string
    The key of the service account token.
    Name string
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    NamePrefix string
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    ReadyForRotation bool
    Signals that the service account token is expired or within the period to be early rotated.
    SecondsToLive int
    The token expiration in seconds.
    ServiceAccountId string
    The ID of the service account to which the token belongs.
    DeleteOnDestroy bool
    EarlyRotationWindowSeconds int
    Duration of the time window before expiring where the token can be rotated, in seconds.
    Expiration string
    The expiration date of the service account token.
    HasExpired bool
    The status of the service account token.
    Key string
    The key of the service account token.
    Name string
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    NamePrefix string
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    ReadyForRotation bool
    Signals that the service account token is expired or within the period to be early rotated.
    SecondsToLive int
    The token expiration in seconds.
    ServiceAccountId string
    The ID of the service account to which the token belongs.
    deleteOnDestroy Boolean
    earlyRotationWindowSeconds Integer
    Duration of the time window before expiring where the token can be rotated, in seconds.
    expiration String
    The expiration date of the service account token.
    hasExpired Boolean
    The status of the service account token.
    key String
    The key of the service account token.
    name String
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    namePrefix String
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    readyForRotation Boolean
    Signals that the service account token is expired or within the period to be early rotated.
    secondsToLive Integer
    The token expiration in seconds.
    serviceAccountId String
    The ID of the service account to which the token belongs.
    deleteOnDestroy boolean
    earlyRotationWindowSeconds number
    Duration of the time window before expiring where the token can be rotated, in seconds.
    expiration string
    The expiration date of the service account token.
    hasExpired boolean
    The status of the service account token.
    key string
    The key of the service account token.
    name string
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    namePrefix string
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    readyForRotation boolean
    Signals that the service account token is expired or within the period to be early rotated.
    secondsToLive number
    The token expiration in seconds.
    serviceAccountId string
    The ID of the service account to which the token belongs.
    delete_on_destroy bool
    early_rotation_window_seconds int
    Duration of the time window before expiring where the token can be rotated, in seconds.
    expiration str
    The expiration date of the service account token.
    has_expired bool
    The status of the service account token.
    key str
    The key of the service account token.
    name str
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    name_prefix str
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    ready_for_rotation bool
    Signals that the service account token is expired or within the period to be early rotated.
    seconds_to_live int
    The token expiration in seconds.
    service_account_id str
    The ID of the service account to which the token belongs.
    deleteOnDestroy Boolean
    earlyRotationWindowSeconds Number
    Duration of the time window before expiring where the token can be rotated, in seconds.
    expiration String
    The expiration date of the service account token.
    hasExpired Boolean
    The status of the service account token.
    key String
    The key of the service account token.
    name String
    The name of the service account token. It will start with <name_prefix>- and will have characters appended to it to make the name unique.
    namePrefix String
    Prefix for the name of the service account tokens created by this resource. The actual name will be stored in the computed field name, which will be in the format <name_prefix>-<additional_characters>.
    readyForRotation Boolean
    Signals that the service account token is expired or within the period to be early rotated.
    secondsToLive Number
    The token expiration in seconds.
    serviceAccountId String
    The ID of the service account to which the token belongs.

    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 v2.18.0 published on Wednesday, Dec 3, 2025 by pulumiverse
      Meet Neo: Your AI Platform Teammate