我正在尝试通过 SSM(系统管理器- https://docs.aws.amazon.com/systems-manager/latest 访问在秘密管理器( https://aws.amazon.com/secrets-manager/ )中创建的秘密/userguide/systems-manager-parameter-store.html ) 即 AWS 参数存储,并将其存储在 serverless.yml 文件中的自定义 YAML 变量中?我正在尝试通过无服务器框架(https://serverless.com/)实现云形成,并且我正在尝试在云形成中实现嵌套的 if 语句,以便使用下面的代码实现上述功能。
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}
我已经尝试过云形成内在函数 Fn::If 为此但面临这个错误:
Fn::If requires a list argument with the first element being a condition