I am trying to create a canary resource that uses a script that needs a secret. I'm trying to add a policy statement to the canary role (which I'm creating as part of the cdk). To do this I need to get the secrets full arn, I can get the partial arn with
secret_from_name = secretsmanager.Secret.from_secret_name_v2
then use it like
resources = [secret_from_name.secret_arn]
but that doesn't give me the full arn and the permissions don't work.
.....because no identity-based policy allows the secretsmanager:GetSecretValue action
Thought I would get around this by doing
resources = [secret_from_name.secret_full_arn]
But because this is derived by name, it doesn't get the full arn and you get 'undefined'
I also tried getting it from attribute using the partial arn, no joy there either.
So is there any way around this? As what I don't want to do is pass around full arn's or is there another way I can grant access to this reousece?