(core): unable to create JSON secret using secret values #20461
Labels
@aws-cdk/core
Related to core CDK functionality
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
good first issue
Related to contributions. See CONTRIBUTING.md
p1
Describe the bug
See #20033 (comment)
With the new API, creating Secrets with compound values looks like this:
Which is not a great experience.
Expected Behavior
Can create JSON secret containing another secret.
Current Behavior
Not allowed.
Reproduction Steps
See linked example.
Possible Solution
I've considered making
SecretValue
contain compound values, but the API doesn't quite become satisfying:Is fine as far as it goes, but the problem with this API is it cannot be distinguished from this invocation:
So it would need to be called
unsafeJsonObject
, but since when used properly this is the normal course for Secret usage, I don't want to call a methodunsafe
if it isn't actuallyunsafe
.It also seems that creating compound SecretValues is only used for initializing a
Secret
, and isn't used anywhere else. So, I'm thinking a better solution is to make it a feature ofnew sm.Secret
:The type of
secretObjectValue
would be{ [x: string]: SecretValue }
When writing a unit test for this, be sure to test with the
@aws-cdk/core.preventUnsafePlaintextSecrets
flag on, and update the documentation onSecretValue.unsafePlainText()
to explain other reasonable use cases for static strings in here.Additional Information/Context
No response
CDK CLI Version
Framework Version
No response
Node.js Version
OS
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: