我正在尝试创建一个使用需要秘密的脚本的金丝雀资源。我正在尝试向金丝雀角色添加政策声明(我将其作为 cdk 的一部分创建)。为此,我需要获取完整的秘密 arn,我可以使用以下命令获取部分 arn
secret_from_name = secretsmanager.Secret.from_secret_name_v2
Run Code Online (Sandbox Code Playgroud)
然后像这样使用它
resources = [secret_from_name.secret_arn]
Run Code Online (Sandbox Code Playgroud)
但这并没有给我完整的 arn 并且权限不起作用。
.....because no identity-based policy allows the secretsmanager:GetSecretValue action
Run Code Online (Sandbox Code Playgroud)
我想我可以通过这样做来解决这个问题
.....because no identity-based policy allows the secretsmanager:GetSecretValue action
Run Code Online (Sandbox Code Playgroud)
但因为这是通过名称派生的,所以它不会获得完整的 arn,并且您会得到“未定义”
我还尝试使用部分 arn 从属性中获取它,但也没有什么乐趣。
那么有什么办法可以解决这个问题吗?因为我不想做的是传递完整的 arn,或者是否有其他方法可以授予对此 reousece 的访问权限?