-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiam.tf
65 lines (56 loc) · 1.81 KB
/
iam.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
resource "aws_iam_user" "jay_sheth_IAM_user" {
name = "JayShethUser"
}
resource "aws_iam_user_policy_attachment" "jay_sheth_user_policy_attachment" {
user = aws_iam_user.jay_sheth_IAM_user.name
policy_arn = "arn:aws:iam::aws:policy/AWSCodeCommitFullAccess"
}
resource "aws_iam_service_specific_credential" "jay_sheth_HTTPS_credentials" {
service_name = "codecommit.amazonaws.com"
user_name = aws_iam_user.jay_sheth_IAM_user.name
}
data "aws_iam_policy_document" "assume_role_amplify" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["amplify.amazonaws.com"]
}
}
}
data "aws_iam_policy_document" "assume_role_lambda" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["lambda.amazonaws.com"]
}
}
}
#IAM role providing read-only access to CodeCommit
resource "aws_iam_role" "amplify-codecommit" {
name = "JayAmplifyCodeCommit"
assume_role_policy = join("", data.aws_iam_policy_document.assume_role_amplify.*.json)
managed_policy_arns = ["arn:aws:iam::aws:policy/AWSCodeCommitReadOnly"]
}
resource "aws_iam_role" "lambda_dynamodb" {
name = "JayShethWildRydesLambda"
inline_policy {
name = "DynamoDBWriteAccess"
policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Sid = "VisualEditor0",
Effect = "Allow",
Action = "dynamodb:PutItem",
Resource = "arn:aws:dynamodb:us-east-1:587172484624:table/jay-sheth-dynamo-db"
}
]
})
}
assume_role_policy = join("",data.aws_iam_policy_document.assume_role_lambda.*.json)
managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
}