1. Packages
  2. AWS
  3. API Docs
  4. secretsmanager
  5. getSecrets
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.secretsmanager.getSecrets

Explore with Pulumi AI

AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

Use this data source to get the ARNs and names of Secrets Manager secrets matching the specified criteria.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.secretsmanager.getSecrets({
    filters: [{
        name: "name",
        values: ["example"],
    }],
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.secretsmanager.get_secrets(filters=[{
    "name": "name",
    "values": ["example"],
}])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/secretsmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretsmanager.GetSecrets(ctx, &secretsmanager.GetSecretsArgs{
			Filters: []secretsmanager.GetSecretsFilter{
				{
					Name: "name",
					Values: []string{
						"example",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.SecretsManager.GetSecrets.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.SecretsManager.Inputs.GetSecretsFilterInputArgs
            {
                Name = "name",
                Values = new[]
                {
                    "example",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.secretsmanager.SecretsmanagerFunctions;
import com.pulumi.aws.secretsmanager.inputs.GetSecretsArgs;
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 example = SecretsmanagerFunctions.getSecrets(GetSecretsArgs.builder()
            .filters(GetSecretsFilterArgs.builder()
                .name("name")
                .values("example")
                .build())
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:secretsmanager:getSecrets
      arguments:
        filters:
          - name: name
            values:
              - example
Copy

Using getSecrets

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 getSecrets(args: GetSecretsArgs, opts?: InvokeOptions): Promise<GetSecretsResult>
function getSecretsOutput(args: GetSecretsOutputArgs, opts?: InvokeOptions): Output<GetSecretsResult>
Copy
def get_secrets(filters: Optional[Sequence[GetSecretsFilter]] = None,
                opts: Optional[InvokeOptions] = None) -> GetSecretsResult
def get_secrets_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSecretsFilterArgs]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetSecretsResult]
Copy
func GetSecrets(ctx *Context, args *GetSecretsArgs, opts ...InvokeOption) (*GetSecretsResult, error)
func GetSecretsOutput(ctx *Context, args *GetSecretsOutputArgs, opts ...InvokeOption) GetSecretsResultOutput
Copy

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

public static class GetSecrets 
{
    public static Task<GetSecretsResult> InvokeAsync(GetSecretsArgs args, InvokeOptions? opts = null)
    public static Output<GetSecretsResult> Invoke(GetSecretsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecretsResult> getSecrets(GetSecretsArgs args, InvokeOptions options)
public static Output<GetSecretsResult> getSecrets(GetSecretsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:secretsmanager/getSecrets:getSecrets
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetSecretsFilter>
Configuration block(s) for filtering. Detailed below.
Filters []GetSecretsFilter
Configuration block(s) for filtering. Detailed below.
filters List<GetSecretsFilter>
Configuration block(s) for filtering. Detailed below.
filters GetSecretsFilter[]
Configuration block(s) for filtering. Detailed below.
filters Sequence[GetSecretsFilter]
Configuration block(s) for filtering. Detailed below.
filters List<Property Map>
Configuration block(s) for filtering. Detailed below.

getSecrets Result

The following output properties are available:

Arns List<string>
Set of ARNs of the matched Secrets Manager secrets.
Id string
The provider-assigned unique ID for this managed resource.
Names List<string>
Set of names of the matched Secrets Manager secrets.
Filters List<GetSecretsFilter>
Arns []string
Set of ARNs of the matched Secrets Manager secrets.
Id string
The provider-assigned unique ID for this managed resource.
Names []string
Set of names of the matched Secrets Manager secrets.
Filters []GetSecretsFilter
arns List<String>
Set of ARNs of the matched Secrets Manager secrets.
id String
The provider-assigned unique ID for this managed resource.
names List<String>
Set of names of the matched Secrets Manager secrets.
filters List<GetSecretsFilter>
arns string[]
Set of ARNs of the matched Secrets Manager secrets.
id string
The provider-assigned unique ID for this managed resource.
names string[]
Set of names of the matched Secrets Manager secrets.
filters GetSecretsFilter[]
arns Sequence[str]
Set of ARNs of the matched Secrets Manager secrets.
id str
The provider-assigned unique ID for this managed resource.
names Sequence[str]
Set of names of the matched Secrets Manager secrets.
filters Sequence[GetSecretsFilter]
arns List<String>
Set of ARNs of the matched Secrets Manager secrets.
id String
The provider-assigned unique ID for this managed resource.
names List<String>
Set of names of the matched Secrets Manager secrets.
filters List<Property Map>

Supporting Types

GetSecretsFilter

Name This property is required. string
Name of the filter field. Valid values can be found in the Secrets Manager ListSecrets API Reference.
Values This property is required. List<string>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
Name This property is required. string
Name of the filter field. Valid values can be found in the Secrets Manager ListSecrets API Reference.
Values This property is required. []string
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. String
Name of the filter field. Valid values can be found in the Secrets Manager ListSecrets API Reference.
values This property is required. List<String>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. string
Name of the filter field. Valid values can be found in the Secrets Manager ListSecrets API Reference.
values This property is required. string[]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. str
Name of the filter field. Valid values can be found in the Secrets Manager ListSecrets API Reference.
values This property is required. Sequence[str]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. String
Name of the filter field. Valid values can be found in the Secrets Manager ListSecrets API Reference.
values This property is required. List<String>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi