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

[rds] Can't export the secret name from a DatabaseCluster #10914

Closed
ericzbeard opened this issue Oct 16, 2020 · 2 comments · Fixed by #11202
Closed

[rds] Can't export the secret name from a DatabaseCluster #10914

ericzbeard opened this issue Oct 16, 2020 · 2 comments · Fixed by #11202
Assignees
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. in-progress This issue is being actively worked on.

Comments

@ericzbeard
Copy link
Contributor

It is not possible to export the name of the secret that is generated by the DatabaseCluster construct.

Reproduction Steps

        # Create the cluster
        cluster = rds.DatabaseCluster(
            self,
            "Database",
            engine=rds.DatabaseClusterEngine.aurora_mysql(
                version=rds.AuroraMysqlEngineVersion.VER_2_09_0
            ),
            instance_props={
                "instance_type": ec2.InstanceType.of(
                    ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MEDIUM
                ),
                "vpc_subnets": {"subnet_type": ec2.SubnetType.PRIVATE},
                "vpc": vpc,
                "security_groups": [aurora_sg],
            },
        )

        # Output RDS secret name
        _ = core.CfnOutput(
            self,
            "MySecretOut",
            value=cluster.secret.secret_name,
            export_name="my-secret-name",
        )

What did you expect to happen?

The secret name should be exported in the synthesized template.

What actually happened?

The resource in the template is missing the Value, which causes a deployment failure.

    "MySecretOut": {
      "Export": {
        "Name": "my-secret-name"
      }
    }

Environment

  • CLI Version : 1.68
  • Framework Version:
  • Node.js Version:
  • OS :
  • Language (Version):

Other

We should also modify CfnOutput to fail when the value provided is undefined.


This is 🐛 Bug Report

@ericzbeard ericzbeard added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 16, 2020
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label Oct 16, 2020
@mfsjr
Copy link

mfsjr commented Oct 21, 2020

I'm experiencing this as well, I'm on CLI version 1.67.

@njlynch njlynch self-assigned this Oct 27, 2020
njlynch added a commit that referenced this issue 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
@njlynch njlynch added in-progress This issue is being actively worked on. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 29, 2020
@mergify mergify bot closed this as completed in #11202 Nov 5, 2020
mergify bot pushed a commit that referenced this issue Nov 5, 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*
@github-actions
Copy link

github-actions bot commented Nov 5, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. in-progress This issue is being actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants