1. Packages
  2. Grafana Cloud
  3. API Docs
  4. CloudApiKey
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

grafana.CloudApiKey

Explore with Pulumi AI

grafana logo
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

    This resource is deprecated and will be removed in a future release. Please use grafana.CloudAccessPolicy instead.

    Manages a single API key on the Grafana Cloud portal (on the organization level)

    Required access policy scopes:

    • api-keys:read
    • api-keys:write
    • api-keys:delete

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/grafana";
    
    const test = new grafana.CloudApiKey("test", {
        cloudOrgSlug: "myorg",
        role: "Admin",
    });
    
    import pulumi
    import pulumiverse_grafana as grafana
    
    test = grafana.CloudApiKey("test",
        cloud_org_slug="myorg",
        role="Admin")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := grafana.NewCloudApiKey(ctx, "test", &grafana.CloudApiKeyArgs{
    			CloudOrgSlug: pulumi.String("myorg"),
    			Role:         pulumi.String("Admin"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumiverse.Grafana;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Grafana.CloudApiKey("test", new()
        {
            CloudOrgSlug = "myorg",
            Role = "Admin",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.grafana.CloudApiKey;
    import com.pulumi.grafana.CloudApiKeyArgs;
    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 CloudApiKey("test", CloudApiKeyArgs.builder()        
                .cloudOrgSlug("myorg")
                .role("Admin")
                .build());
    
        }
    }
    
    resources:
      test:
        type: grafana:CloudApiKey
        properties:
          cloudOrgSlug: myorg
          role: Admin
    

    Create CloudApiKey Resource

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

    Constructor syntax

    new CloudApiKey(name: string, args: CloudApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def CloudApiKey(resource_name: str,
                    args: CloudApiKeyArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def CloudApiKey(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    cloud_org_slug: Optional[str] = None,
                    role: Optional[str] = None,
                    name: Optional[str] = None)
    func NewCloudApiKey(ctx *Context, name string, args CloudApiKeyArgs, opts ...ResourceOption) (*CloudApiKey, error)
    public CloudApiKey(string name, CloudApiKeyArgs args, CustomResourceOptions? opts = null)
    public CloudApiKey(String name, CloudApiKeyArgs args)
    public CloudApiKey(String name, CloudApiKeyArgs args, CustomResourceOptions options)
    
    type: grafana:CloudApiKey
    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 CloudApiKeyArgs
    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 CloudApiKeyArgs
    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 CloudApiKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CloudApiKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CloudApiKeyArgs
    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 cloudApiKeyResource = new Grafana.CloudApiKey("cloudApiKeyResource", new()
    {
        CloudOrgSlug = "string",
        Role = "string",
        Name = "string",
    });
    
    example, err := grafana.NewCloudApiKey(ctx, "cloudApiKeyResource", &grafana.CloudApiKeyArgs{
    	CloudOrgSlug: pulumi.String("string"),
    	Role:         pulumi.String("string"),
    	Name:         pulumi.String("string"),
    })
    
    var cloudApiKeyResource = new CloudApiKey("cloudApiKeyResource", CloudApiKeyArgs.builder()
        .cloudOrgSlug("string")
        .role("string")
        .name("string")
        .build());
    
    cloud_api_key_resource = grafana.CloudApiKey("cloudApiKeyResource",
        cloud_org_slug="string",
        role="string",
        name="string")
    
    const cloudApiKeyResource = new grafana.CloudApiKey("cloudApiKeyResource", {
        cloudOrgSlug: "string",
        role: "string",
        name: "string",
    });
    
    type: grafana:CloudApiKey
    properties:
        cloudOrgSlug: string
        name: string
        role: string
    

    CloudApiKey Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The CloudApiKey resource accepts the following input properties:

    CloudOrgSlug string
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    Role string
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    Name string
    Name of the API key.
    CloudOrgSlug string
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    Role string
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    Name string
    Name of the API key.
    cloudOrgSlug String
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    role String
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    name String
    Name of the API key.
    cloudOrgSlug string
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    role string
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    name string
    Name of the API key.
    cloud_org_slug str
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    role str
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    name str
    Name of the API key.
    cloudOrgSlug String
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    role String
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    name String
    Name of the API key.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The generated API key.
    Id string
    The provider-assigned unique ID for this managed resource.
    Key string
    The generated API key.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The generated API key.
    id string
    The provider-assigned unique ID for this managed resource.
    key string
    The generated API key.
    id str
    The provider-assigned unique ID for this managed resource.
    key str
    The generated API key.
    id String
    The provider-assigned unique ID for this managed resource.
    key String
    The generated API key.

    Look up Existing CloudApiKey Resource

    Get an existing CloudApiKey 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?: CloudApiKeyState, opts?: CustomResourceOptions): CloudApiKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cloud_org_slug: Optional[str] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            role: Optional[str] = None) -> CloudApiKey
    func GetCloudApiKey(ctx *Context, name string, id IDInput, state *CloudApiKeyState, opts ...ResourceOption) (*CloudApiKey, error)
    public static CloudApiKey Get(string name, Input<string> id, CloudApiKeyState? state, CustomResourceOptions? opts = null)
    public static CloudApiKey get(String name, Output<String> id, CloudApiKeyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    CloudOrgSlug string
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    Key string
    The generated API key.
    Name string
    Name of the API key.
    Role string
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    CloudOrgSlug string
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    Key string
    The generated API key.
    Name string
    Name of the API key.
    Role string
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    cloudOrgSlug String
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    key String
    The generated API key.
    name String
    Name of the API key.
    role String
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    cloudOrgSlug string
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    key string
    The generated API key.
    name string
    Name of the API key.
    role string
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    cloud_org_slug str
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    key str
    The generated API key.
    name str
    Name of the API key.
    role str
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.
    cloudOrgSlug String
    The slug of the organization to create the API key in. This is the same slug as the organization name in the URL.
    key String
    The generated API key.
    name String
    Name of the API key.
    role String
    Role of the API key. Should be one of [Viewer Editor Admin MetricsPublisher PluginPublisher]. See https://grafana.com/docs/grafana-cloud/api/#create-api-key for details.

    Import

    $ pulumi import grafana:index/cloudApiKey:CloudApiKey name "{{ orgSlug }}:{{ apiKeyName }}"
    

    To learn more about importing existing cloud resources, see Importing resources.

    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 v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse