Open reskin89 opened 1 year ago
Files identified in the description: None
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
Same on collection amazon.aws 6.4.0
aws_secret lookup does not support cross-account secrets.
any progress on this?
I need to reference secrets cross account as i dont want to have them stored in each account (hard to managed that way). Any progress ? or workaround?
@surry355f1,
I just tried a basic test of looking up a secret by ARN in our CI, and can't reproduce the issue ( See #2211 the test logs are at https://f06bb1c0876a2035eb30-0541d2f937b216ef65e5a86231415176.ssl.cf2.rackcdn.com/2211/fd522070620168012fe4afade452eaf434f4e3e4/check/integration-amazon.aws-1/2cd1ff0/job-output.txt )
I've also performed a quick cross-account test (not possible inside our CI) and I'm able to access the secrets using this lookup module.
This would seem to imply that the issue is with the permissions (especially since the error given is AccessDenied), rather than with this lookup module itself. Please see https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_examples_cross.html for an example of the necessary permissions, which includes configuring permissions for both SecretsManager and KMS.
Summary
When using the
aws_secret
lookup plugin, it seems it only accepts a secret name, but not a full ARN, resulting in a failure to read cross account secrets.Issue Type
Bug Report
Component Name
aws_secret
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Amazon Linux 2 and MacOS
Steps to Reproduce
my-super-secret-password
with the alias/name of your secret in the initial accountExpected Results
I expect the secret to be read and value rendered, instead a permission denied replies.
To ensure the instance can read the secret, running
aws secretesmanager get-secret-value --secret-id FULLARN
works without issue from the instance in question.Actual Results
But logging into this instance and using the aws CLI:
Code of Conduct