question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(secretsmanager): Access secret string stored in secret manager from CDK

See original GitHub issue

I am storing the Codestar connection string for Bitbucket in Secret manager. How can I retrieve it in the CDK app:

I am trying with:

// Get Bitbucket Connection String
const bitbucketConnectionString = Secret.fromSecretCompleteArn(this, "bitbucketConnectionString", "arn:aws:secretsmanager:us-west-2:1000000000:secret:BitbucketCloudConnection-abcdef0");


// SourceAction
const sourceAction = new BitBucketSourceAction({
    actionName: 'BitbucketSource',
    owner: 'abc',
    repo: repoName,
    output: sourceOutputArtifact,
    connectionArn: bitbucketConnectionString,
})

bitbucketConnectionString is not a string though.

  1. How do I access the secret value which is actually a connectionString stored in Secret Manager.

  2. What is the right way to replace region and accountId with Pseudo variables in the connection string;

    arn:aws:secretsmanager:us-west-2:1000000000㊙️BitbucketCloudConnection-abcdef0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jogoldcommented, Nov 28, 2020
// SourceAction
const sourceAction = new BitBucketSourceAction({
    actionName: 'BitbucketSource',
    owner: 'abc',
    repo: repoName,
    output: sourceOutputArtifact,
     // use it with secret name, no need for the -abcdef0 part
    connectionArn: SecretValue.fromSecretsManager('BitbucketCloudConnection').toString()
})

Just like the example in the README in core.

SecretValue is a class from @aws-cdk/core.

0reactions
github-actions[bot]commented, Dec 7, 2020

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-secretsmanager module - AWS Documentation
Secrets imported by name should use the short-form of the name (without the SecretsManager-provided suffx); the secret name must exist in the same...
Read more >
Access string stored in secret manager from CDK
I am storing the Codestar connection string for Bitbucket in Secret manager. How can I retrieve it in the CDK app: I am...
Read more >
Pattern: Secure AWS secret handling with TypeScript CDK
AWS Secrets Manager. Allows you to store, rotate, version and retrieve secrets. It uses KMS under the covers and also applies encryption at ......
Read more >
Store and Rotate API Keys with AWS Secrets Manager
The AWS console only supports string values containing plaintext or JSON formatted key-value pairs. Binary secrets must be managed via the API. Secret...
Read more >
Securely Use Secrets In Your AWS CDK Deployed Lambda ...
I will be using Python flavored AWS CDK to deploy a Lambda function which has permissions to access a secret stored in Secrets...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found