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 System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var myApiKey = Aws.ApiGateway.GetKey.Invoke(new()
    {
        Id = "ru3mpjgse6",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.ApigatewayFunctions;
import com.pulumi.aws.apigateway.inputs.GetKeyArgs;
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) {
        final var myApiKey = ApigatewayFunctions.getKey(GetKeyArgs.builder()
            .id("ru3mpjgse6")
            .build());

    }
}
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 = aws.apigateway.getKey({
    id: "ru3mpjgse6",
});
variables:
  myApiKey:
    fn::invoke:
      Function: aws:apigateway:getKey
      Arguments:
        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)
}
public static CompletableFuture<GetKeyResult> getKey(GetKeyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: aws:apigateway/getKey:getKey
  arguments:
    # arguments dictionary

The following arguments are supported:

Id string

ID of the API Key to look up.

Tags Dictionary<string, string>

Map of tags for the resource.

Id string

ID of the API Key to look up.

Tags map[string]string

Map of tags for the resource.

id String

ID of the API Key to look up.

tags Map<String,String>

Map of tags for the resource.

id string

ID of the API Key to look up.

tags {[key: string]: string}

Map of tags for the resource.

id str

ID of the API Key to look up.

tags Mapping[str, str]

Map of tags for the resource.

id String

ID of the API Key to look up.

tags Map<String>

Map of tags for the resource.

getKey Result

The following output properties are available:

CreatedDate string

Date and time when the API Key was created.

Description string

Description of the API Key.

Enabled bool

Whether the API Key is enabled.

Id string

Set to the ID of the API Key.

LastUpdatedDate string

Date and time when the API Key was last updated.

Name string

Set to the name of the API Key.

Tags Dictionary<string, string>

Map of tags for the resource.

Value string

Set to the value of the API Key.

CreatedDate string

Date and time when the API Key was created.

Description string

Description of the API Key.

Enabled bool

Whether the API Key is enabled.

Id string

Set to the ID of the API Key.

LastUpdatedDate string

Date and time when the API Key was last updated.

Name string

Set to the name of the API Key.

Tags map[string]string

Map of tags for the resource.

Value string

Set to the value of the API Key.

createdDate String

Date and time when the API Key was created.

description String

Description of the API Key.

enabled Boolean

Whether the API Key is enabled.

id String

Set to the ID of the API Key.

lastUpdatedDate String

Date and time when the API Key was last updated.

name String

Set to the name of the API Key.

tags Map<String,String>

Map of tags for the resource.

value String

Set to the value of the API Key.

createdDate string

Date and time when the API Key was created.

description string

Description of the API Key.

enabled boolean

Whether the API Key is enabled.

id string

Set to the ID of the API Key.

lastUpdatedDate string

Date and time when the API Key was last updated.

name string

Set to the name of the API Key.

tags {[key: string]: string}

Map of tags for the resource.

value string

Set to the value of the API Key.

created_date str

Date and time when the API Key was created.

description str

Description of the API Key.

enabled bool

Whether the API Key is enabled.

id str

Set to the ID of the API Key.

last_updated_date str

Date and time when the API Key was last updated.

name str

Set to the name of the API Key.

tags Mapping[str, str]

Map of tags for the resource.

value str

Set to the value of the API Key.

createdDate String

Date and time when the API Key was created.

description String

Description of the API Key.

enabled Boolean

Whether the API Key is enabled.

id String

Set to the ID of the API Key.

lastUpdatedDate String

Date and time when the API Key was last updated.

name String

Set to the name of the API Key.

tags Map<String>

Map of tags for the resource.

value String

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.