I’m trying to access secrets created in secrets manager(AWS Secrets Manager | Rotate, Manage, Retrieve Secrets | Amazon Web Services (AWS)) via SSM (Systems Manager- AWS Systems Manager Parameter Store - AWS Systems Manager ) i.e. AWS Parameter store, and store it in a custom YAML variable in serverless.yml file?
I am trying to implement cloud formation through serverless framework(https://serverless.com/), and I am trying to implement a nested if statement in cloud formation for implementing the above using the code below.
stage: &stage 'dev' #Hardcoded for now
rdsMasterPassword:
!If
- !Equals [*stage,"prod"]
- ${ssm:/aws/reference/secretsmanager/cred-prod~true:rdsMasterPassword}
- !If
- !Equals [*stage,"staging"]
- ${ssm:/aws/reference/secretsmanager/cred-staging~true:rdsMasterPassword}
- ${ssm:/aws/reference/secretsmanager/cred-dev~true:rdsMasterPassword}
I have tried Cloud formation instrinsic functions Fn::If for this but facing this errror :
Fn::If requires a list argument with the first element being a condition
?