iam_splunk_sh.tf 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Creates an IAM role so that splunk can trigger creation of audit reports
  2. resource "aws_iam_role" "run_audit_report_role" {
  3. name = "run_audit_report_role"
  4. path = "/service/"
  5. assume_role_policy = jsonencode(
  6. {
  7. "Version" : "2012-10-17",
  8. "Statement" : [
  9. {
  10. "Effect" : "Allow",
  11. "Principal" : {
  12. "AWS" : "arn:${var.aws_partition}:iam::${var.c2_accounts[var.aws_partition]}:role/instance/moose-splunk-sh-instance-role"
  13. },
  14. "Action" : "sts:AssumeRole"
  15. }
  16. ]
  17. })
  18. tags = merge(local.standard_tags, var.tags)
  19. }
  20. # tfsec:ignore:aws-iam-no-policy-wildcards Allows use by the entire account
  21. data "aws_iam_policy_document" "run_audit_report_policy_doc" {
  22. statement {
  23. sid = ""
  24. effect = "Allow"
  25. resources = ["*"]
  26. actions = [
  27. "acm-pca:CreateCertificateAuthorityAuditReport"
  28. ]
  29. }
  30. }
  31. resource "aws_iam_policy" "run_audit_report_policy" {
  32. name = "run_audit_report_policy"
  33. path = "/"
  34. policy = data.aws_iam_policy_document.run_audit_report_policy_doc.json
  35. }
  36. resource "aws_iam_role_policy_attachment" "run_audit_report_policy_attach" {
  37. role = aws_iam_role.run_audit_report_role.name
  38. policy_arn = aws_iam_policy.run_audit_report_policy.arn
  39. }