forked from Flaconi/terraform-aws-iam-ses-user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
35 lines (29 loc) · 830 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
resource "aws_iam_user" "this" {
count = var.enabled ? 1 : 0
name = var.user_name
path = var.path
permissions_boundary = var.permissions_boundary
force_destroy = var.force_destroy
tags = var.tags
}
resource "aws_iam_access_key" "this" {
count = var.enabled ? 1 : 0
user = aws_iam_user.this[0].name
pgp_key = var.pgp_key
}
data "aws_iam_policy_document" "ses_send_access" {
statement {
effect = "Allow"
actions = [
"ses:SendRawEmail",
"ses:SendEmail"
]
resources = ["*"]
}
}
resource "aws_iam_user_policy" "this" {
count = var.enabled ? 1 : 0
name_prefix = var.user_policy_name_prefix
user = aws_iam_user.this[0].name
policy = data.aws_iam_policy_document.ses_send_access.json
}