getKey

Use this data source to get the name and value of a pre-existing API Key, for example to supply credentials for a dependency microservice.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var myApiKey = Output.Create(Aws.ApiGateway.GetKey.InvokeAsync(new Aws.ApiGateway.GetKeyArgs
        {
            Id = "ru3mpjgse6",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/apigateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := apigateway.GetKey(ctx, &apigateway.GetKeyArgs{
			Id: "ru3mpjgse6",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

my_api_key = aws.apigateway.get_key(id="ru3mpjgse6")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const myApiKey = pulumi.output(aws.apigateway.getKey({
    id: "ru3mpjgse6",
}));

Using getKey

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getKey(args: GetKeyArgs, opts?: InvokeOptions): Promise<GetKeyResult>
function getKeyOutput(args: GetKeyOutputArgs, opts?: InvokeOptions): Output<GetKeyResult>
def get_key(id: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            opts: Optional[InvokeOptions] = None) -> GetKeyResult
def get_key_output(id: Optional[pulumi.Input[str]] = None,
            tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetKeyResult]
func GetKey(ctx *Context, args *GetKeyArgs, opts ...InvokeOption) (*GetKeyResult, error)
func GetKeyOutput(ctx *Context, args *GetKeyOutputArgs, opts ...InvokeOption) GetKeyResultOutput

> Note: This function is named GetKey in the Go SDK.

public static class GetKey 
{
    public static Task<GetKeyResult> InvokeAsync(GetKeyArgs args, InvokeOptions? opts = null)
    public static Output<GetKeyResult> Invoke(GetKeyInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Id string
The ID of the API Key to look up.
Tags Dictionary<string, string>
A map of tags for the resource.
Id string
The ID of the API Key to look up.
Tags map[string]string
A map of tags for the resource.
id string
The ID of the API Key to look up.
tags {[key: string]: string}
A map of tags for the resource.
id str
The ID of the API Key to look up.
tags Mapping[str, str]
A map of tags for the resource.

getKey Result

The following output properties are available:

CreatedDate string
The date and time when the API Key was created.
Description string
The description of the API Key.
Enabled bool
Specifies whether the API Key is enabled.
Id string
Set to the ID of the API Key.
LastUpdatedDate string
The date and time when the API Key was last updated.
Name string
Set to the name of the API Key.
Tags Dictionary<string, string>
A map of tags for the resource.
Value string
Set to the value of the API Key.
CreatedDate string
The date and time when the API Key was created.
Description string
The description of the API Key.
Enabled bool
Specifies whether the API Key is enabled.
Id string
Set to the ID of the API Key.
LastUpdatedDate string
The date and time when the API Key was last updated.
Name string
Set to the name of the API Key.
Tags map[string]string
A map of tags for the resource.
Value string
Set to the value of the API Key.
createdDate string
The date and time when the API Key was created.
description string
The description of the API Key.
enabled boolean
Specifies whether the API Key is enabled.
id string
Set to the ID of the API Key.
lastUpdatedDate string
The date and time when the API Key was last updated.
name string
Set to the name of the API Key.
tags {[key: string]: string}
A map of tags for the resource.
value string
Set to the value of the API Key.
created_date str
The date and time when the API Key was created.
description str
The description of the API Key.
enabled bool
Specifies whether the API Key is enabled.
id str
Set to the ID of the API Key.
last_updated_date str
The date and time when the API Key was last updated.
name str
Set to the name of the API Key.
tags Mapping[str, str]
A map of tags for the resource.
value str
Set to the value of the API Key.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.