-
Notifications
You must be signed in to change notification settings - Fork 41
/
main.tf
41 lines (35 loc) · 925 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
36
37
38
39
40
41
resource "aws_iam_role" "terraform" {
name = "Terraform"
assume_role_policy = data.aws_iam_policy_document.terraform_assume_role.json
}
data "aws_caller_identity" "current" {}
# assume role policy data
data "aws_iam_policy_document" "terraform_assume_role" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
}
}
}
resource "aws_iam_role_policy" "manipulate_resources" {
name = "ManipulateAWSResources"
role = aws_iam_role.terraform.id
policy = data.aws_iam_policy_document.manipulate_resources.json
}
data "aws_iam_policy_document" "manipulate_resources" {
statement {
effect = "Allow"
resources = ["*"]
actions = [
"iam:*",
"kms:*",
"logs:*",
"ec2:*",
"eks:*",
"autoscaling:*",
"ssm:GetParameter"
]
}
}