main.tf 763 B

123456789101112131415161718192021222324252627282930
  1. data aws_partition this {}
  2. resource "aws_iam_user" "this" {
  3. name = "qualys"
  4. path = "/service_accounts/"
  5. tags = var.tags
  6. force_destroy = true
  7. }
  8. resource "aws_iam_access_key" "this" {
  9. user = aws_iam_user.this.name
  10. pgp_key = var.pgp_key
  11. }
  12. resource "aws_iam_user_policy" "assume_role" {
  13. name = "assume_role"
  14. user = aws_iam_user.this.name
  15. policy = data.aws_iam_policy_document.assume_role.json
  16. }
  17. data aws_iam_policy_document "assume_role" {
  18. statement {
  19. effect = "Allow"
  20. actions = ["sts:AssumeRole"]
  21. resources = [
  22. "arn:${data.aws_partition.this.partition}:iam::*:role/QualysConnectorRole",
  23. "arn:${data.aws_partition.this.partition}:iam::*:role/Role_For_QualysEC2Connector",
  24. ]
  25. }
  26. }