GetSecret
Retrieve metadata information about a Secrets Manager secret. To retrieve a secret value, see the aws.secretsmanager.SecretVersion.
Example Usage
ARN
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var by_arn = Output.Create(Aws.SecretsManager.GetSecret.InvokeAsync(new Aws.SecretsManager.GetSecretArgs
{
Arn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456",
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := "arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456"
_, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{
Arn: &opt0,
}, nil)
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
by_arn = aws.secretsmanager.get_secret(arn="arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const by_arn = pulumi.output(aws.secretsmanager.getSecret({
arn: "arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456",
}, { async: true }));Name
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var by_name = Output.Create(Aws.SecretsManager.GetSecret.InvokeAsync(new Aws.SecretsManager.GetSecretArgs
{
Name = "example",
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := "example"
_, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{
Name: &opt0,
}, nil)
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
by_name = aws.secretsmanager.get_secret(name="example")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const by_name = pulumi.output(aws.secretsmanager.getSecret({
name: "example",
}, { async: true }));Using GetSecret
function getSecret(args: GetSecretArgs, opts?: InvokeOptions): Promise<GetSecretResult>function get_secret(arn=None, name=None, opts=None)func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)Note: This function is named
LookupSecretin the Go SDK.
public static class GetSecret {
public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
GetSecret Result
The following output properties are available:
- Arn string
The Amazon Resource Name (ARN) of the secret.
- Description string
A description of the secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Kms
Key stringId The Key Management Service (KMS) Customer Master Key (CMK) associated with the secret.
- Name string
- Policy string
The resource-based policy document that’s attached to the secret.
- Rotation
Enabled bool Whether rotation is enabled or not.
- Rotation
Lambda stringArn Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.
- Rotation
Rules List<GetSecret Rotation Rule> Rotation rules if rotation is enabled.
- Dictionary<string, string>
Tags of the secret.
- Arn string
The Amazon Resource Name (ARN) of the secret.
- Description string
A description of the secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Kms
Key stringId The Key Management Service (KMS) Customer Master Key (CMK) associated with the secret.
- Name string
- Policy string
The resource-based policy document that’s attached to the secret.
- Rotation
Enabled bool Whether rotation is enabled or not.
- Rotation
Lambda stringArn Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.
- Rotation
Rules []GetSecret Rotation Rule Rotation rules if rotation is enabled.
- map[string]string
Tags of the secret.
- arn string
The Amazon Resource Name (ARN) of the secret.
- description string
A description of the secret.
- id string
The provider-assigned unique ID for this managed resource.
- kms
Key stringId The Key Management Service (KMS) Customer Master Key (CMK) associated with the secret.
- name string
- policy string
The resource-based policy document that’s attached to the secret.
- rotation
Enabled boolean Whether rotation is enabled or not.
- rotation
Lambda stringArn Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.
- rotation
Rules GetSecret Rotation Rule[] Rotation rules if rotation is enabled.
- {[key: string]: string}
Tags of the secret.
- arn str
The Amazon Resource Name (ARN) of the secret.
- description str
A description of the secret.
- id str
The provider-assigned unique ID for this managed resource.
- kms_
key_ strid The Key Management Service (KMS) Customer Master Key (CMK) associated with the secret.
- name str
- policy str
The resource-based policy document that’s attached to the secret.
- rotation_
enabled bool Whether rotation is enabled or not.
- rotation_
lambda_ strarn Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.
- rotation_
rules List[GetSecret Rotation Rule] Rotation rules if rotation is enabled.
- Dict[str, str]
Tags of the secret.
Supporting Types
GetSecretRotationRule
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.