SecretAttributes Struct
Attributes required to import an existing secret into the Stack.
One ARN format (secretArn, secretCompleteArn, secretPartialArn) must be provided.
| Source | aws-secretsmanager/lib/secret.ts |
|---|
Example
ts
const userpool = new cognito.UserPool(this, 'Pool');
const secret = secretsmanager.Secret.fromSecretAttributes(this, "CognitoClientSecret", {
secretCompleteArn: "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
}).secretValue
const provider = new cognito.UserPoolIdentityProviderGoogle(this, 'Google', {
clientId: 'amzn-client-id',
clientSecretValue: secret,
userPool: userpool,
});
python
userpool = cognito.UserPool(self, "Pool")
secret = secretsmanager.Secret.from_secret_attributes(self, "CognitoClientSecret",
secret_complete_arn="arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
).secret_value
provider = cognito.UserPoolIdentityProviderGoogle(self, "Google",
client_id="amzn-client-id",
client_secret_value=secret,
user_pool=userpool
)
java
UserPool userpool = new UserPool(this, "Pool");
SecretValue secret = Secret.fromSecretAttributes(this, "CognitoClientSecret", SecretAttributes.builder()
.secretCompleteArn("arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx")
.build()).getSecretValue();
UserPoolIdentityProviderGoogle provider = UserPoolIdentityProviderGoogle.Builder.create(this, "Google")
.clientId("amzn-client-id")
.clientSecretValue(secret)
.userPool(userpool)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var userpool = new UserPool(this, "Pool");
var secret = Secret.FromSecretAttributes(this, "CognitoClientSecret", new SecretAttributes {
SecretCompleteArn = "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
}).SecretValue;
var provider = new UserPoolIdentityProviderGoogle(this, "Google", new UserPoolIdentityProviderGoogleProps {
ClientId = "amzn-client-id",
ClientSecretValue = secret,
UserPool = userpool
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
userpool := cognito.NewUserPool(this, jsii.String("Pool"))
secret := secretsmanager.Secret_FromSecretAttributes(this, jsii.String("CognitoClientSecret"), &SecretAttributes{
SecretCompleteArn: jsii.String("arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"),
}).SecretValue
provider := cognito.NewUserPoolIdentityProviderGoogle(this, jsii.String("Google"), &UserPoolIdentityProviderGoogleProps{
ClientId: jsii.String("amzn-client-id"),
ClientSecretValue: secret,
UserPool: userpool,
})
Properties
encryptionKeyoptionalIKeyencryption_keyoptionalIKeyencryptionKeyoptionalIKeyEncryptionKeyoptionalIKeyEncryptionKeyoptionalIKey #The encryption key that is used to encrypt the secret, unless the default SecretsManager key is used.
secretCompleteArnoptionalstringsecret_complete_arnoptionalstrsecretCompleteArnoptionalStringSecretCompleteArnoptionalstringSecretCompleteArnoptional*string #The complete ARN of the secret in SecretsManager.
This is the ARN including the Secrets Manager 6-character suffix. Cannot be used with secretArn or secretPartialArn.
secretPartialArnoptionalstringsecret_partial_arnoptionalstrsecretPartialArnoptionalStringSecretPartialArnoptionalstringSecretPartialArnoptional*string #The partial ARN of the secret in SecretsManager.
This is the ARN without the Secrets Manager 6-character suffix. Cannot be used with secretArn or secretCompleteArn.