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:
- Early
Rotation intWindow Seconds - Duration of the time window before expiring where the token can be rotated, in seconds.
- Name
Prefix 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>. - Seconds
To intLive - The token expiration in seconds.
- Service
Account stringId - The ID of the service account to which the token belongs.
- Delete
On boolDestroy
- Early
Rotation intWindow Seconds - Duration of the time window before expiring where the token can be rotated, in seconds.
- Name
Prefix 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>. - Seconds
To intLive - The token expiration in seconds.
- Service
Account stringId - The ID of the service account to which the token belongs.
- Delete
On boolDestroy
- early
Rotation IntegerWindow Seconds - Duration of the time window before expiring where the token can be rotated, in seconds.
- name
Prefix 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>. - seconds
To IntegerLive - The token expiration in seconds.
- service
Account StringId - The ID of the service account to which the token belongs.
- delete
On BooleanDestroy
- early
Rotation numberWindow Seconds - Duration of the time window before expiring where the token can be rotated, in seconds.
- name
Prefix 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>. - seconds
To numberLive - The token expiration in seconds.
- service
Account stringId - The ID of the service account to which the token belongs.
- delete
On booleanDestroy
- early_
rotation_ intwindow_ seconds - 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_ intlive - The token expiration in seconds.
- service_
account_ strid - The ID of the service account to which the token belongs.
- delete_
on_ booldestroy
- early
Rotation NumberWindow Seconds - Duration of the time window before expiring where the token can be rotated, in seconds.
- name
Prefix 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>. - seconds
To NumberLive - The token expiration in seconds.
- service
Account StringId - The ID of the service account to which the token belongs.
- delete
On BooleanDestroy
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.
- Has
Expired 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. - Ready
For boolRotation - 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.
- Has
Expired 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. - Ready
For boolRotation - 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.
- has
Expired 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. - ready
For BooleanRotation - 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.
- has
Expired 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. - ready
For booleanRotation - 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_ boolrotation - 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.
- has
Expired 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. - ready
For BooleanRotation - 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) -> ServiceAccountRotatingTokenfunc 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.
- Delete
On boolDestroy - Early
Rotation intWindow Seconds - 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.
- Has
Expired 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. - Name
Prefix 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>. - Ready
For boolRotation - Signals that the service account token is expired or within the period to be early rotated.
- Seconds
To intLive - The token expiration in seconds.
- Service
Account stringId - The ID of the service account to which the token belongs.
- Delete
On boolDestroy - Early
Rotation intWindow Seconds - 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.
- Has
Expired 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. - Name
Prefix 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>. - Ready
For boolRotation - Signals that the service account token is expired or within the period to be early rotated.
- Seconds
To intLive - The token expiration in seconds.
- Service
Account stringId - The ID of the service account to which the token belongs.
- delete
On BooleanDestroy - early
Rotation IntegerWindow Seconds - 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.
- has
Expired 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. - name
Prefix 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>. - ready
For BooleanRotation - Signals that the service account token is expired or within the period to be early rotated.
- seconds
To IntegerLive - The token expiration in seconds.
- service
Account StringId - The ID of the service account to which the token belongs.
- delete
On booleanDestroy - early
Rotation numberWindow Seconds - 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.
- has
Expired 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. - name
Prefix 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>. - ready
For booleanRotation - Signals that the service account token is expired or within the period to be early rotated.
- seconds
To numberLive - The token expiration in seconds.
- service
Account stringId - The ID of the service account to which the token belongs.
- delete_
on_ booldestroy - early_
rotation_ intwindow_ seconds - 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_ boolrotation - Signals that the service account token is expired or within the period to be early rotated.
- seconds_
to_ intlive - The token expiration in seconds.
- service_
account_ strid - The ID of the service account to which the token belongs.
- delete
On BooleanDestroy - early
Rotation NumberWindow Seconds - 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.
- has
Expired 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. - name
Prefix 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>. - ready
For BooleanRotation - Signals that the service account token is expired or within the period to be early rotated.
- seconds
To NumberLive - The token expiration in seconds.
- service
Account StringId - 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
grafanaTerraform Provider.
