Secret class
Provides a resource to manage AWS Secrets Manager secret metadata. To manage secret rotation, see the aws.secretsmanager.SecretRotation resource. To manage a secret value, see the aws.secretsmanager.SecretVersion resource.
Example Usage
Basic
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.secretsmanager.Secret("example", {name: "example"});
import pulumi
import pulumi_aws as aws
example = aws.secretsmanager.Secret("example", name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.SecretsManager.Secret("example", new()
{
Name = "example",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := secretsmanager.NewSecret(ctx, "example", &secretsmanager.SecretArgs{
Name: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_secretsmanager_secret" "example" {
name = "example"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.secretsmanager.Secret;
import com.pulumi.aws.secretsmanager.SecretArgs;
import java.util.ArrayList;
import java.util.Arrays;
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) {
var example = new Secret("example", SecretArgs.builder()
.name("example")
.build());
}
}
resources:
example:
type: aws:secretsmanager:Secret
properties:
name: example
Managed External Secret
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.secretsmanager.Secret("example", {
name: "bigid-client-secret",
type: "BigIDClientSecret",
});
import pulumi
import pulumi_aws as aws
example = aws.secretsmanager.Secret("example",
name="bigid-client-secret",
type="BigIDClientSecret")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.SecretsManager.Secret("example", new()
{
Name = "bigid-client-secret",
Type = "BigIDClientSecret",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/secretsmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := secretsmanager.NewSecret(ctx, "example", &secretsmanager.SecretArgs{
Name: pulumi.String("bigid-client-secret"),
Type: pulumi.String("BigIDClientSecret"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_secretsmanager_secret" "example" {
name = "bigid-client-secret"
type = "BigIDClientSecret"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.secretsmanager.Secret;
import com.pulumi.aws.secretsmanager.SecretArgs;
import java.util.ArrayList;
import java.util.Arrays;
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) {
var example = new Secret("example", SecretArgs.builder()
.name("bigid-client-secret")
.type("BigIDClientSecret")
.build());
}
}
resources:
example:
type: aws:secretsmanager:Secret
properties:
name: bigid-client-secret
type: BigIDClientSecret
For more information about managed external secrets and supported partners, see the AWS documentation.
Import
Identity Schema
Required
arn(String) ARN of the Secrets Manager secret.
Using pulumi import, import aws.secretsmanager.Secret using the secret ARN. For example:
$ pulumi import aws:secretsmanager/secret:Secret example arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456
Constructors
- Secret(String name, {SecretArgs? args, CustomResourceOptions? options})
-
Creates a new Secret.
nameThe Pulumi resource name.argsArguments used to configure this Secret. The set of arguments for Secret.optionsResource options controlling this resource's behavior. - Secret.reference(String urn)
- Creates a typed reference to an existing Secret resource.
Properties
-
arn
↔ Output<
String> -
ARN of the secret.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
description
↔ Output<
String?> -
Description of the secret.
latefinal
-
forceOverwriteReplicaSecret
↔ Output<
bool?> -
Accepts boolean value to specify whether to overwrite a secret with the same name in the destination Region.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
kmsKeyId
↔ Output<
String?> -
ARN or Id of the AWS KMS key to be used to encrypt the secret values in the versions stored in this secret. If you need to reference a CMK in a different account, you can use only the key ARN. If you don't specify this value, then Secrets Manager defaults to using the AWS account's default KMS key (the one named
aws/secretsmanager). If the default KMS key with that name doesn't yet exist, then AWS Secrets Manager creates it for you automatically the first time.latefinal -
name
↔ Output<
String> -
Friendly name of the new secret. The secret name can consist of uppercase letters, lowercase letters, digits, and any of the following characters:
/_+=.@-Conflicts withnamePrefix.latefinal -
namePrefix
↔ Output<
String> -
Creates a unique name beginning with the specified prefix. Conflicts with
name.latefinal -
policy
↔ Output<
String> -
Valid JSON document representing a resource policy. Removing
policyfrom your configuration or settingpolicyto null or an empty string (i.e.,policy = "") will not delete the policy since it could have been set byaws.secretsmanager.SecretPolicy. To delete thepolicy, set it to"{}"(an empty JSON document).latefinal -
recoveryWindowInDays
↔ Output<
int?> -
Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be
0to force deletion without recovery or range from7to30days. The default value is30.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
replicas
↔ Output<
List< SecretReplica> > -
Configuration block to support secret replication. See details below.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
Key-value map of user-defined tags that are attached to the secret. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
type
↔ Output<
String?> -
Type of secret for managed external secrets. Valid values are
SalesforceClientSecret,BigIDClientSecret, andSnowflakeKeyPairAuthentication. For more information about supported partners and their specific requirements, see Managed external secret partners. This attribute cannot be changed after creation.latefinal -
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited