forked from tbekas/aws-organization-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
52 lines (41 loc) · 1.1 KB
/
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
42
43
44
45
46
47
48
49
50
51
provider "aws" {
region = "eu-central-1"
}
provider "aws" {
assume_role {
role_arn = "arn:aws:iam::${aws_organizations_account.users.id}:role/Admin"
}
alias = "users"
region = "eu-central-1"
}
provider "aws" {
assume_role {
role_arn = "arn:aws:iam::${aws_organizations_account.staging.id}:role/Admin"
}
alias = "staging"
region = "eu-central-1"
}
provider "aws" {
assume_role {
role_arn = "arn:aws:iam::${aws_organizations_account.production.id}:role/Admin"
}
alias = "production"
region = "eu-central-1"
}
resource "aws_organizations_organization" "organization" {
}
resource "aws_organizations_account" "users" {
name = local.account_name["users"]
email = local.account_owner_email["users"]
role_name = "Admin"
}
resource "aws_organizations_account" "staging" {
name = local.account_name["staging"]
email = local.account_owner_email["staging"]
role_name = "Admin"
}
resource "aws_organizations_account" "production" {
name = local.account_name["production"]
email = local.account_owner_email["production"]
role_name = "Admin"
}