1. Packages
  2. AWS
  3. API Docs
  4. grafana
  5. WorkspaceApiKey
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.grafana.WorkspaceApiKey

Explore with Pulumi AI

Provides an Amazon Managed Grafana workspace API Key resource.

Example Usage

Basic configuration

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const key = new aws.grafana.WorkspaceApiKey("key", {
    keyName: "test-key",
    keyRole: "VIEWER",
    secondsToLive: 3600,
    workspaceId: test.id,
});
Copy
import pulumi
import pulumi_aws as aws

key = aws.grafana.WorkspaceApiKey("key",
    key_name="test-key",
    key_role="VIEWER",
    seconds_to_live=3600,
    workspace_id=test["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/grafana"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := grafana.NewWorkspaceApiKey(ctx, "key", &grafana.WorkspaceApiKeyArgs{
			KeyName:       pulumi.String("test-key"),
			KeyRole:       pulumi.String("VIEWER"),
			SecondsToLive: pulumi.Int(3600),
			WorkspaceId:   pulumi.Any(test.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var key = new Aws.Grafana.WorkspaceApiKey("key", new()
    {
        KeyName = "test-key",
        KeyRole = "VIEWER",
        SecondsToLive = 3600,
        WorkspaceId = test.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.grafana.WorkspaceApiKey;
import com.pulumi.aws.grafana.WorkspaceApiKeyArgs;
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 key = new WorkspaceApiKey("key", WorkspaceApiKeyArgs.builder()
            .keyName("test-key")
            .keyRole("VIEWER")
            .secondsToLive(3600)
            .workspaceId(test.id())
            .build());

    }
}
Copy
resources:
  key:
    type: aws:grafana:WorkspaceApiKey
    properties:
      keyName: test-key
      keyRole: VIEWER
      secondsToLive: 3600
      workspaceId: ${test.id}
Copy

Create WorkspaceApiKey Resource

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

Constructor syntax

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

@overload
def WorkspaceApiKey(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    key_name: Optional[str] = None,
                    key_role: Optional[str] = None,
                    seconds_to_live: Optional[int] = None,
                    workspace_id: Optional[str] = None)
func NewWorkspaceApiKey(ctx *Context, name string, args WorkspaceApiKeyArgs, opts ...ResourceOption) (*WorkspaceApiKey, error)
public WorkspaceApiKey(string name, WorkspaceApiKeyArgs args, CustomResourceOptions? opts = null)
public WorkspaceApiKey(String name, WorkspaceApiKeyArgs args)
public WorkspaceApiKey(String name, WorkspaceApiKeyArgs args, CustomResourceOptions options)
type: aws:grafana:WorkspaceApiKey
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. WorkspaceApiKeyArgs
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. WorkspaceApiKeyArgs
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. WorkspaceApiKeyArgs
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. WorkspaceApiKeyArgs
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. WorkspaceApiKeyArgs
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 workspaceApiKeyResource = new Aws.Grafana.WorkspaceApiKey("workspaceApiKeyResource", new()
{
    KeyName = "string",
    KeyRole = "string",
    SecondsToLive = 0,
    WorkspaceId = "string",
});
Copy
example, err := grafana.NewWorkspaceApiKey(ctx, "workspaceApiKeyResource", &grafana.WorkspaceApiKeyArgs{
	KeyName:       pulumi.String("string"),
	KeyRole:       pulumi.String("string"),
	SecondsToLive: pulumi.Int(0),
	WorkspaceId:   pulumi.String("string"),
})
Copy
var workspaceApiKeyResource = new WorkspaceApiKey("workspaceApiKeyResource", WorkspaceApiKeyArgs.builder()
    .keyName("string")
    .keyRole("string")
    .secondsToLive(0)
    .workspaceId("string")
    .build());
Copy
workspace_api_key_resource = aws.grafana.WorkspaceApiKey("workspaceApiKeyResource",
    key_name="string",
    key_role="string",
    seconds_to_live=0,
    workspace_id="string")
Copy
const workspaceApiKeyResource = new aws.grafana.WorkspaceApiKey("workspaceApiKeyResource", {
    keyName: "string",
    keyRole: "string",
    secondsToLive: 0,
    workspaceId: "string",
});
Copy
type: aws:grafana:WorkspaceApiKey
properties:
    keyName: string
    keyRole: string
    secondsToLive: 0
    workspaceId: string
Copy

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

KeyName
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the API key. Key names must be unique to the workspace.
KeyRole
This property is required.
Changes to this property will trigger replacement.
string
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
SecondsToLive This property is required. int
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
WorkspaceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the workspace that the API key is valid for.
KeyName
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the API key. Key names must be unique to the workspace.
KeyRole
This property is required.
Changes to this property will trigger replacement.
string
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
SecondsToLive This property is required. int
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
WorkspaceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the workspace that the API key is valid for.
keyName
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the API key. Key names must be unique to the workspace.
keyRole
This property is required.
Changes to this property will trigger replacement.
String
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
secondsToLive This property is required. Integer
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspaceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the workspace that the API key is valid for.
keyName
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the API key. Key names must be unique to the workspace.
keyRole
This property is required.
Changes to this property will trigger replacement.
string
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
secondsToLive This property is required. number
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspaceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the workspace that the API key is valid for.
key_name
This property is required.
Changes to this property will trigger replacement.
str
Specifies the name of the API key. Key names must be unique to the workspace.
key_role
This property is required.
Changes to this property will trigger replacement.
str
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
seconds_to_live This property is required. int
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspace_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the workspace that the API key is valid for.
keyName
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the API key. Key names must be unique to the workspace.
keyRole
This property is required.
Changes to this property will trigger replacement.
String
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
secondsToLive This property is required. Number
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspaceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the workspace that the API key is valid for.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Key string
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
Id string
The provider-assigned unique ID for this managed resource.
Key string
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
id String
The provider-assigned unique ID for this managed resource.
key String
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
id string
The provider-assigned unique ID for this managed resource.
key string
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
id str
The provider-assigned unique ID for this managed resource.
key str
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
id String
The provider-assigned unique ID for this managed resource.
key String
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.

Look up Existing WorkspaceApiKey Resource

Get an existing WorkspaceApiKey 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?: WorkspaceApiKeyState, opts?: CustomResourceOptions): WorkspaceApiKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key: Optional[str] = None,
        key_name: Optional[str] = None,
        key_role: Optional[str] = None,
        seconds_to_live: Optional[int] = None,
        workspace_id: Optional[str] = None) -> WorkspaceApiKey
func GetWorkspaceApiKey(ctx *Context, name string, id IDInput, state *WorkspaceApiKeyState, opts ...ResourceOption) (*WorkspaceApiKey, error)
public static WorkspaceApiKey Get(string name, Input<string> id, WorkspaceApiKeyState? state, CustomResourceOptions? opts = null)
public static WorkspaceApiKey get(String name, Output<String> id, WorkspaceApiKeyState state, CustomResourceOptions options)
resources:  _:    type: aws:grafana:WorkspaceApiKey    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:
Key string
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
KeyName Changes to this property will trigger replacement. string
Specifies the name of the API key. Key names must be unique to the workspace.
KeyRole Changes to this property will trigger replacement. string
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
SecondsToLive int
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
WorkspaceId Changes to this property will trigger replacement. string
The ID of the workspace that the API key is valid for.
Key string
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
KeyName Changes to this property will trigger replacement. string
Specifies the name of the API key. Key names must be unique to the workspace.
KeyRole Changes to this property will trigger replacement. string
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
SecondsToLive int
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
WorkspaceId Changes to this property will trigger replacement. string
The ID of the workspace that the API key is valid for.
key String
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
keyName Changes to this property will trigger replacement. String
Specifies the name of the API key. Key names must be unique to the workspace.
keyRole Changes to this property will trigger replacement. String
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
secondsToLive Integer
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspaceId Changes to this property will trigger replacement. String
The ID of the workspace that the API key is valid for.
key string
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
keyName Changes to this property will trigger replacement. string
Specifies the name of the API key. Key names must be unique to the workspace.
keyRole Changes to this property will trigger replacement. string
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
secondsToLive number
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspaceId Changes to this property will trigger replacement. string
The ID of the workspace that the API key is valid for.
key str
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
key_name Changes to this property will trigger replacement. str
Specifies the name of the API key. Key names must be unique to the workspace.
key_role Changes to this property will trigger replacement. str
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
seconds_to_live int
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspace_id Changes to this property will trigger replacement. str
The ID of the workspace that the API key is valid for.
key String
The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
keyName Changes to this property will trigger replacement. String
Specifies the name of the API key. Key names must be unique to the workspace.
keyRole Changes to this property will trigger replacement. String
Specifies the permission level of the API key. Valid values are VIEWER, EDITOR, or ADMIN.
secondsToLive Number
Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
workspaceId Changes to this property will trigger replacement. String
The ID of the workspace that the API key is valid for.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.