Terraform resource: aws secretsmanager secret policy

From wikieduonline
Jump to navigation Jump to search

aws_secretsmanager_secret_policy(tf.io)

Official example[edit]

resource "aws_secretsmanager_secret" "example" {
 name = "example"
}

data "aws_iam_policy_document" "example" {
 statement {
   sid    = "EnableAnotherAWSAccountToReadTheSecret"
   effect = "Allow"

   principals {
     type        = "AWS"
     identifiers = ["arn:aws:iam::123456789012:root"]
   }

   actions   = ["secretsmanager:GetSecretValue"]
   resources = ["*"]
 }
}
resource "aws_secretsmanager_secret_policy" "example" {
 secret_arn = aws_secretsmanager_secret.example.arn
 policy     = data.aws_iam_policy_document.example.json
}

Related[edit]

See also[edit]

Advertising: