Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(secretsmanager): can't export secret name from Secret #11202

Merged
merged 3 commits into from
Nov 5, 2020

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Oct 29, 2020

For owned Secrets, secretName was set to the physical name, which was set to
the provided secretName if given, or a Token otherwise. However, the Token was
never resolved, as the secretName isn't actually a return vaue / attribute.

The fix explicitly sets the secretName either to the inputted name or the
parsed name from the ARN. Note that this means the secret name will be the
partial/"friendly" name (e.g., 'MySecret') if the secret name was passed in,
and the full name (e.g., 'MySecret-123abc') otherwise.

fixes #10914


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

For owned Secrets, `secretName` was set to the physical name, which was set to
the provided `secretName` if given, or a Token otherwise. However, the Token was
never resolved, as the `secretName` isn't actually a return vaue / attribute.

The fix explicitly sets the `secretName` either to the inputted name or the
parsed name from the ARN. Note that this means the secret name will be the
partial/"friendly" name (e.g., 'MySecret') if the secret name was passed in,
and the full name (e.g., 'MySecret-123abc') otherwise.

fixes #10914
@njlynch njlynch requested a review from a team October 29, 2020 16:47
@njlynch njlynch self-assigned this Oct 29, 2020
@gitpod-io
Copy link

gitpod-io bot commented Oct 29, 2020

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Oct 29, 2020
@njlynch njlynch requested a review from eladb October 30, 2020 09:53
@njlynch njlynch requested a review from a team November 3, 2020 15:26
@mergify
Copy link
Contributor

mergify bot commented Nov 5, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Nov 5, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 5dcdecb into master Nov 5, 2020
@mergify mergify bot deleted the njlynch/secretnamesforownedsecrets branch November 5, 2020 09:11
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: c7ed6bf
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

njlynch added a commit that referenced this pull request Nov 26, 2020
…der feature flag)

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused `Secret.secretName` to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can formulate how to parse the resourceName to get the
secretName based on either (a) knowing the secret name or (b) knowing the format
that CloudFormation uses when secret names aren't specified. This fix introduces
proper parsing of secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the `@aws-cdk/secretsmanager:parseOwnedSecretName` flag.
njlynch added a commit that referenced this pull request Nov 26, 2020
…der feature flag)

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused `Secret.secretName` to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can formulate how to parse the resourceName to get the
secretName based on either (a) knowing the secret name or (b) knowing the format
that CloudFormation uses when secret names aren't specified. This fix introduces
proper parsing of secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the `@aws-cdk/secretsmanager:parseOwnedSecretName` flag.

fixes #11727
njlynch added a commit that referenced this pull request Nov 26, 2020
…der feature flag)

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused `Secret.secretName` to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can parse the resourceName to get the secretName based on
either (a) knowing the secret name or (b) knowing the format that CloudFormation
uses when secret names aren't specified. This fix introduces proper parsing of
secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the `@aws-cdk/secretsmanager:parseOwnedSecretName` flag.

fixes #11727
njlynch added a commit that referenced this pull request Nov 26, 2020
…der feature flag)

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused `Secret.secretName` to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can parse the resourceName to get the secretName based on
either (a) knowing the secret name or (b) knowing the format that CloudFormation
uses when secret names aren't specified. This fix introduces proper parsing of
secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the `@aws-cdk/secretsmanager:parseOwnedSecretName` flag.

fixes #11727
mergify bot pushed a commit that referenced this pull request Nov 30, 2020
…der feature flag) (#11736)

Proper (tokenized) secret names for owned secrets was introduced in #11202. This
caused `Secret.secretName` to return the full resource name (secret name + suffix)
for owned secrets. This was done to ensure that the secretName was a Tokenized
value that would create a dependency between the Secret and its consumer.

However, Secrets Manager's DescribeSecret API does not accept the resourceName
as an input; it accepts the full ARN, a partial ARN (without the suffix), or the
secret name (without the suffix). This leads to several integrations with other
services or custom scripts to fail when using the secretName from an owned
Secret.

For owned secrets, we can parse the resourceName to get the secretName based on
either (a) knowing the secret name or (b) knowing the format that CloudFormation
uses when secret names aren't specified. This fix introduces proper parsing of
secret names for owned secrets (behind a feature flag).

BREAKING CHANGE: (feature flag) Secret.secretName for owned secrets will now
only the secret name (without suffix) and not the full resource name. This is
enabled through the `@aws-cdk/secretsmanager:parseOwnedSecretName` flag.

fixes #11727

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rds] Can't export the secret name from a DatabaseCluster
4 participants