In Terraform aws
provider, we can use the below to attach a Resource based policy to the secrets manager.
- Create a
aws_iam_policy_document
Data resource and attach the same to the secrets manger - Create policy using
aws_secretsmanager_secret_policy
for a secrets manager.
I remember the older versions of the provider for e.g 2.7 did not had aws_secretsmanager_secret_policy
and we had to use the data resource to attach policy to the secrets manager. Now the latest version supports both.
What is the benefit of using the aws_secretsmanager_secret_policy
over aws_iam_policy_document
and under what conditions we can choose one over the other ?