GetKey
Use this data source to get detailed information about the specified KMS Key with flexible key id input. This can be useful to reference key alias without having to hard code the ARN as input.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var foo = Output.Create(Aws.Kms.GetKey.InvokeAsync(new Aws.Kms.GetKeyArgs
{
KeyId = "arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/kms"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := kms.LookupKey(ctx, &kms.LookupKeyArgs{
KeyId: "arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
}, nil)
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
foo = aws.kms.get_key(key_id="arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const foo = pulumi.output(aws.kms.getKey({
keyId: "arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
}, { async: true }));Using GetKey
function getKey(args: GetKeyArgs, opts?: InvokeOptions): Promise<GetKeyResult>function get_key(grant_tokens=None, key_id=None, opts=None)func LookupKey(ctx *Context, args *LookupKeyArgs, opts ...InvokeOption) (*LookupKeyResult, error)Note: This function is named
LookupKeyin the Go SDK.
public static class GetKey {
public static Task<GetKeyResult> InvokeAsync(GetKeyArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Key
Id string Key identifier which can be one of the following format: * Key ID. E.g:
1234abcd-12ab-34cd-56ef-1234567890ab* Key ARN. E.g.:arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab* Alias name. E.g.:alias/my-key* Alias ARN: E.g.:arn:aws:kms:us-east-1:111122223333:alias/my-key- Grant
Tokens List<string> List of grant tokens
- Key
Id string Key identifier which can be one of the following format: * Key ID. E.g:
1234abcd-12ab-34cd-56ef-1234567890ab* Key ARN. E.g.:arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab* Alias name. E.g.:alias/my-key* Alias ARN: E.g.:arn:aws:kms:us-east-1:111122223333:alias/my-key- Grant
Tokens []string List of grant tokens
- key
Id string Key identifier which can be one of the following format: * Key ID. E.g:
1234abcd-12ab-34cd-56ef-1234567890ab* Key ARN. E.g.:arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab* Alias name. E.g.:alias/my-key* Alias ARN: E.g.:arn:aws:kms:us-east-1:111122223333:alias/my-key- grant
Tokens string[] List of grant tokens
- key_
id str Key identifier which can be one of the following format: * Key ID. E.g:
1234abcd-12ab-34cd-56ef-1234567890ab* Key ARN. E.g.:arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab* Alias name. E.g.:alias/my-key* Alias ARN: E.g.:arn:aws:kms:us-east-1:111122223333:alias/my-key- grant_
tokens List[str] List of grant tokens
GetKey Result
The following output properties are available:
- Arn string
- Aws
Account stringId - Creation
Date string - Customer
Master stringKey Spec - Deletion
Date string - Description string
- Enabled bool
- Expiration
Model string - Id string
The provider-assigned unique ID for this managed resource.
- Key
Id string - Key
Manager string - Key
State string - Key
Usage string - Origin string
- Valid
To string - Grant
Tokens List<string>
- Arn string
- Aws
Account stringId - Creation
Date string - Customer
Master stringKey Spec - Deletion
Date string - Description string
- Enabled bool
- Expiration
Model string - Id string
The provider-assigned unique ID for this managed resource.
- Key
Id string - Key
Manager string - Key
State string - Key
Usage string - Origin string
- Valid
To string - Grant
Tokens []string
- arn string
- aws
Account stringId - creation
Date string - customer
Master stringKey Spec - deletion
Date string - description string
- enabled boolean
- expiration
Model string - id string
The provider-assigned unique ID for this managed resource.
- key
Id string - key
Manager string - key
State string - key
Usage string - origin string
- valid
To string - grant
Tokens string[]
- arn str
- aws_
account_ strid - creation_
date str - customer_
master_ strkey_ spec - deletion_
date str - description str
- enabled bool
- expiration_
model str - id str
The provider-assigned unique ID for this managed resource.
- key_
id str - key_
manager str - key_
state str - key_
usage str - origin str
- valid_
to str - grant_
tokens List[str]
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.