Serverless will resolve the object for you.
Assuming that the content of your secret_ID_in_Secrets_Manager
looks like this:
{
"foo": "foo",
"bar": "bar"
}
Then if you define your custom variable in serverless.yml
like this:
custom:
supersecret: ${ssm:/aws/reference/secretsmanager/secret_ID_in_Secrets_Manager~true}
Then this will resolve to:
custom:
supersecret:
foo: foo
bar: bar
You can reference them inside serverless.yml
by using ${self:custom.supersecret.foo}
and ${self:custom.supersecret.bar}
.
See the Serverless documentation and search for Variables can also be object, since AWS Secrets Manager can store secrets not only in plain text but also in JSON..
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…