【发布时间】:2023-01-24 02:05:44
【问题描述】:
- 我在机密管理器中有一个现有机密。
arn 看起来像这样:arn:aws:secretsmanager:<region>:<accountid>:secret:<mysecret>-d1fX1Y
众所周知后缀是AWS加的。“Secrets Manager 在 ARN 末尾的秘密名称后自动添加一个连字符和六个随机字符。”
- 我有一个 cloudformation 模板,我需要以某种方式将这个秘密的 arn 放入模板中。
arn 不是静态的,它可能会改变。
据我所知,不可能使用 !Ref 因为资源不是在同一个堆栈中创建的。
我尝试将 !Sub 与通配符一起使用,但结果与它不进行查找的结果相同。
也许有人对此有想法或解决方法?
这是模板的一部分。
Globals: Function: CodeUri: ./ Timeout: 60 Runtime: nodejs14.x VpcConfig: SecurityGroupIds: !Ref SecurityGroups SubnetIds: !Ref Subnets Environment: Variables: STAGE: !Sub "${Stage}" VERSION: !Sub "${Version}" SECRET_ARN: !Sub "arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:mysecret-*"
【问题讨论】:
标签: amazon-web-services amazon-cloudformation aws-secrets-manager