AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.5.0 published on Wednesday, May 25, 2022 by Pulumi

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/v5/go/aws/secretsmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{
			Arn: pulumi.StringRef("arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var by-arn = Output.of(SecretsmanagerFunctions.getSecret(GetSecretArgs.builder()
            .arn("arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456")
            .build()));

    }
}
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",
}));
variables:
  by-arn:
    Fn::Invoke:
      Function: aws:secretsmanager:getSecret
      Arguments:
        arn: arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456

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/v5/go/aws/secretsmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretsmanager.LookupSecret(ctx, &secretsmanager.LookupSecretArgs{
			Name: pulumi.StringRef("example"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var by-name = Output.of(SecretsmanagerFunctions.getSecret(GetSecretArgs.builder()
            .name("example")
            .build()));

    }
}
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",
}));
variables:
  by-name:
    Fn::Invoke:
      Function: aws:secretsmanager:getSecret
      Arguments:
        name: example

Using getSecret

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 getSecret(args: GetSecretArgs, opts?: InvokeOptions): Promise<GetSecretResult>
function getSecretOutput(args: GetSecretOutputArgs, opts?: InvokeOptions): Output<GetSecretResult>
def get_secret(arn: Optional[str] = None,
               name: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetSecretResult
def get_secret_output(arn: Optional[pulumi.Input[str]] = None,
               name: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetSecretResult]
func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)
func LookupSecretOutput(ctx *Context, args *LookupSecretOutputArgs, opts ...InvokeOption) LookupSecretResultOutput

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

public static class GetSecret 
{
    public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
    public static Output<GetSecretResult> Invoke(GetSecretInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:secretsmanager/getSecret:getSecret
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Arn string

The Amazon Resource Name (ARN) of the secret to retrieve.

Name string

The name of the secret to retrieve.

Arn string

The Amazon Resource Name (ARN) of the secret to retrieve.

Name string

The name of the secret to retrieve.

arn String

The Amazon Resource Name (ARN) of the secret to retrieve.

name String

The name of the secret to retrieve.

arn string

The Amazon Resource Name (ARN) of the secret to retrieve.

name string

The name of the secret to retrieve.

arn str

The Amazon Resource Name (ARN) of the secret to retrieve.

name str

The name of the secret to retrieve.

arn String

The Amazon Resource Name (ARN) of the secret to retrieve.

name String

The name of the secret to retrieve.

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.

KmsKeyId string

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.

RotationEnabled bool

Whether rotation is enabled or not.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

RotationLambdaArn string

Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

RotationRules List<GetSecretRotationRule>

Rotation rules if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

Tags 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.

KmsKeyId string

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.

RotationEnabled bool

Whether rotation is enabled or not.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

RotationLambdaArn string

Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

RotationRules []GetSecretRotationRule

Rotation rules if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

Tags 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.

kmsKeyId String

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.

rotationEnabled Boolean

Whether rotation is enabled or not.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotationLambdaArn String

Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotationRules List<GetSecretRotationRule>

Rotation rules if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

tags 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.

kmsKeyId string

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.

rotationEnabled boolean

Whether rotation is enabled or not.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotationLambdaArn string

Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotationRules GetSecretRotationRule[]

Rotation rules if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

tags {[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_id str

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.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotation_lambda_arn str

Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotation_rules Sequence[GetSecretRotationRule]

Rotation rules if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

tags Mapping[str, str]

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.

kmsKeyId String

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.

rotationEnabled Boolean

Whether rotation is enabled or not.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotationLambdaArn String

Rotation Lambda function Amazon Resource Name (ARN) if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

rotationRules List<Property Map>

Rotation rules if rotation is enabled.

Deprecated:

Use the aws_secretsmanager_secret_rotation data source instead

tags Map<String>

Tags of the secret.

Supporting Types

GetSecretRotationRule

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.