1. Packages
  2. Grafana Cloud
  3. API Docs
  4. CloudStackServiceAccountToken
Grafana v0.16.1 published on Saturday, Mar 15, 2025 by pulumiverse

grafana.CloudStackServiceAccountToken

Explore with Pulumi AI

Deprecated: grafana.index/cloudstackserviceaccounttoken.CloudStackServiceAccountToken has been deprecated in favor of grafana.cloud/stackserviceaccounttoken.StackServiceAccountToken

Manages service account tokens of a Grafana Cloud stack using the Cloud API This can be used to bootstrap a management service account token for a new stack

Required access policy scopes:

  • stack-service-accounts:write

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumiverse/grafana";

const cloudSa = new grafana.cloud.StackServiceAccount("cloud_sa", {
    stackSlug: "<your stack slug>",
    name: "cloud service account",
    role: "Admin",
    isDisabled: false,
});
const foo = new grafana.cloud.StackServiceAccountToken("foo", {
    name: "key_foo",
    serviceAccountId: cloudSa.id,
});
export const serviceAccountTokenFooKey = foo.key;
Copy
import pulumi
import pulumiverse_grafana as grafana

cloud_sa = grafana.cloud.StackServiceAccount("cloud_sa",
    stack_slug="<your stack slug>",
    name="cloud service account",
    role="Admin",
    is_disabled=False)
foo = grafana.cloud.StackServiceAccountToken("foo",
    name="key_foo",
    service_account_id=cloud_sa.id)
pulumi.export("serviceAccountTokenFooKey", foo.key)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/cloud"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cloudSa, err := cloud.NewStackServiceAccount(ctx, "cloud_sa", &cloud.StackServiceAccountArgs{
			StackSlug:  pulumi.String("<your stack slug>"),
			Name:       pulumi.String("cloud service account"),
			Role:       pulumi.String("Admin"),
			IsDisabled: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		foo, err := cloud.NewStackServiceAccountToken(ctx, "foo", &cloud.StackServiceAccountTokenArgs{
			Name:             pulumi.String("key_foo"),
			ServiceAccountId: cloudSa.ID(),
		})
		if err != nil {
			return err
		}
		ctx.Export("serviceAccountTokenFooKey", foo.Key)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Pulumiverse.Grafana;

return await Deployment.RunAsync(() => 
{
    var cloudSa = new Grafana.Cloud.StackServiceAccount("cloud_sa", new()
    {
        StackSlug = "<your stack slug>",
        Name = "cloud service account",
        Role = "Admin",
        IsDisabled = false,
    });

    var foo = new Grafana.Cloud.StackServiceAccountToken("foo", new()
    {
        Name = "key_foo",
        ServiceAccountId = cloudSa.Id,
    });

    return new Dictionary<string, object?>
    {
        ["serviceAccountTokenFooKey"] = foo.Key,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.cloud.StackServiceAccount;
import com.pulumi.grafana.cloud.StackServiceAccountArgs;
import com.pulumi.grafana.cloud.StackServiceAccountToken;
import com.pulumi.grafana.cloud.StackServiceAccountTokenArgs;
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 cloudSa = new StackServiceAccount("cloudSa", StackServiceAccountArgs.builder()
            .stackSlug("<your stack slug>")
            .name("cloud service account")
            .role("Admin")
            .isDisabled(false)
            .build());

        var foo = new StackServiceAccountToken("foo", StackServiceAccountTokenArgs.builder()
            .name("key_foo")
            .serviceAccountId(cloudSa.id())
            .build());

        ctx.export("serviceAccountTokenFooKey", foo.key());
    }
}
Copy
resources:
  cloudSa:
    type: grafana:cloud:StackServiceAccount
    name: cloud_sa
    properties:
      stackSlug: <your stack slug>
      name: cloud service account
      role: Admin
      isDisabled: false
  foo:
    type: grafana:cloud:StackServiceAccountToken
    properties:
      name: key_foo
      serviceAccountId: ${cloudSa.id}
outputs:
  serviceAccountTokenFooKey: ${foo.key}
Copy

Create CloudStackServiceAccountToken Resource

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

Constructor syntax

new CloudStackServiceAccountToken(name: string, args: CloudStackServiceAccountTokenArgs, opts?: CustomResourceOptions);
@overload
def CloudStackServiceAccountToken(resource_name: str,
                                  args: CloudStackServiceAccountTokenArgs,
                                  opts: Optional[ResourceOptions] = None)

@overload
def CloudStackServiceAccountToken(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  name: Optional[str] = None,
                                  seconds_to_live: Optional[int] = None,
                                  service_account_id: Optional[str] = None,
                                  stack_slug: Optional[str] = None)
func NewCloudStackServiceAccountToken(ctx *Context, name string, args CloudStackServiceAccountTokenArgs, opts ...ResourceOption) (*CloudStackServiceAccountToken, error)
public CloudStackServiceAccountToken(string name, CloudStackServiceAccountTokenArgs args, CustomResourceOptions? opts = null)
public CloudStackServiceAccountToken(String name, CloudStackServiceAccountTokenArgs args)
public CloudStackServiceAccountToken(String name, CloudStackServiceAccountTokenArgs args, CustomResourceOptions options)
type: grafana:CloudStackServiceAccountToken
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

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

ServiceAccountId
This property is required.
Changes to this property will trigger replacement.
string
StackSlug
This property is required.
Changes to this property will trigger replacement.
string
Name Changes to this property will trigger replacement. string
SecondsToLive Changes to this property will trigger replacement. int
ServiceAccountId
This property is required.
Changes to this property will trigger replacement.
string
StackSlug
This property is required.
Changes to this property will trigger replacement.
string
Name Changes to this property will trigger replacement. string
SecondsToLive Changes to this property will trigger replacement. int
serviceAccountId
This property is required.
Changes to this property will trigger replacement.
String
stackSlug
This property is required.
Changes to this property will trigger replacement.
String
name Changes to this property will trigger replacement. String
secondsToLive Changes to this property will trigger replacement. Integer
serviceAccountId
This property is required.
Changes to this property will trigger replacement.
string
stackSlug
This property is required.
Changes to this property will trigger replacement.
string
name Changes to this property will trigger replacement. string
secondsToLive Changes to this property will trigger replacement. number
service_account_id
This property is required.
Changes to this property will trigger replacement.
str
stack_slug
This property is required.
Changes to this property will trigger replacement.
str
name Changes to this property will trigger replacement. str
seconds_to_live Changes to this property will trigger replacement. int
serviceAccountId
This property is required.
Changes to this property will trigger replacement.
String
stackSlug
This property is required.
Changes to this property will trigger replacement.
String
name Changes to this property will trigger replacement. String
secondsToLive Changes to this property will trigger replacement. Number

Outputs

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

Expiration string
HasExpired bool
Id string
The provider-assigned unique ID for this managed resource.
Key string
Expiration string
HasExpired bool
Id string
The provider-assigned unique ID for this managed resource.
Key string
expiration String
hasExpired Boolean
id String
The provider-assigned unique ID for this managed resource.
key String
expiration string
hasExpired boolean
id string
The provider-assigned unique ID for this managed resource.
key string
expiration str
has_expired bool
id str
The provider-assigned unique ID for this managed resource.
key str
expiration String
hasExpired Boolean
id String
The provider-assigned unique ID for this managed resource.
key String

Look up Existing CloudStackServiceAccountToken Resource

Get an existing CloudStackServiceAccountToken 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?: CloudStackServiceAccountTokenState, opts?: CustomResourceOptions): CloudStackServiceAccountToken
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        expiration: Optional[str] = None,
        has_expired: Optional[bool] = None,
        key: Optional[str] = None,
        name: Optional[str] = None,
        seconds_to_live: Optional[int] = None,
        service_account_id: Optional[str] = None,
        stack_slug: Optional[str] = None) -> CloudStackServiceAccountToken
func GetCloudStackServiceAccountToken(ctx *Context, name string, id IDInput, state *CloudStackServiceAccountTokenState, opts ...ResourceOption) (*CloudStackServiceAccountToken, error)
public static CloudStackServiceAccountToken Get(string name, Input<string> id, CloudStackServiceAccountTokenState? state, CustomResourceOptions? opts = null)
public static CloudStackServiceAccountToken get(String name, Output<String> id, CloudStackServiceAccountTokenState state, CustomResourceOptions options)
resources:  _:    type: grafana:CloudStackServiceAccountToken    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Expiration string
HasExpired bool
Key string
Name Changes to this property will trigger replacement. string
SecondsToLive Changes to this property will trigger replacement. int
ServiceAccountId Changes to this property will trigger replacement. string
StackSlug Changes to this property will trigger replacement. string
Expiration string
HasExpired bool
Key string
Name Changes to this property will trigger replacement. string
SecondsToLive Changes to this property will trigger replacement. int
ServiceAccountId Changes to this property will trigger replacement. string
StackSlug Changes to this property will trigger replacement. string
expiration String
hasExpired Boolean
key String
name Changes to this property will trigger replacement. String
secondsToLive Changes to this property will trigger replacement. Integer
serviceAccountId Changes to this property will trigger replacement. String
stackSlug Changes to this property will trigger replacement. String
expiration string
hasExpired boolean
key string
name Changes to this property will trigger replacement. string
secondsToLive Changes to this property will trigger replacement. number
serviceAccountId Changes to this property will trigger replacement. string
stackSlug Changes to this property will trigger replacement. string
expiration str
has_expired bool
key str
name Changes to this property will trigger replacement. str
seconds_to_live Changes to this property will trigger replacement. int
service_account_id Changes to this property will trigger replacement. str
stack_slug Changes to this property will trigger replacement. str
expiration String
hasExpired Boolean
key String
name Changes to this property will trigger replacement. String
secondsToLive Changes to this property will trigger replacement. Number
serviceAccountId Changes to this property will trigger replacement. String
stackSlug Changes to this property will trigger replacement. String

Package Details

Repository
grafana pulumiverse/pulumi-grafana
License
Apache-2.0
Notes
This Pulumi package is based on the grafana Terraform Provider.