-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolicy.tf
41 lines (35 loc) · 1.37 KB
/
policy.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
# ------------------------------------------------------------------------------
# CREATE AN AWS IAM POLICY DOCUMENT
# Create the terraform-init AWS IAM policy document that provides the resouce
# permissions for the bootstrap terraform-init user.
# ------------------------------------------------------------------------------
data "aws_iam_policy_document" "terraform_init" {
statement {
sid = "AllowOrgCreation"
actions = [
"organizations:CreateOrganization",
"organizations:DescribeOrganization",
"organizations:CreateAccount",
"organizations:ListAccounts",
"organizations:DescribeAccount",
"organizations:DescribeCreateAccountStatus",
"organizations:ListRoots",
"organizations:ListAWSServiceAccessForOrganization",
"organizations:ListParents",
"organizations:ListTagsForResource"
]
resources = [
"*"
]
}
}
# ------------------------------------------------------------------------------
# CREATE AN AWS IAM POLICY
# Create the terraform-init user AWS IAM policy from the IAM policy document.
# This policy gets attached to the terraform-init user.
# ------------------------------------------------------------------------------
resource "aws_iam_policy" "terraform_init_user" {
name = format("%s_policy", var.name)
path = "/"
policy = data.aws_iam_policy_document.terraform_init.json
}