-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsso_DevOps.tf
70 lines (53 loc) · 2.52 KB
/
sso_DevOps.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
66
67
68
69
70
data "aws_identitystore_group" "DevOps" {
identity_store_id = tolist(data.aws_ssoadmin_instances.okta.identity_store_ids)[0]
filter {
attribute_path = "DisplayName"
attribute_value = "PG_AWSSS0_DEVOPS"
}
}
resource "aws_ssoadmin_managed_policy_attachment" "DevOps_DevEnv_Policy" {
instance_arn = aws_ssoadmin_permission_set.DevOps_DevEnv.instance_arn
count = length(var.DevOps_DevEnv_policy_arn)
managed_policy_arn = var.DevOps_DevEnv_policy_arn[count.index]
permission_set_arn = aws_ssoadmin_permission_set.DevOps_DevEnv.arn
}
resource "aws_ssoadmin_account_assignment" "Admin_DevEnv" {
instance_arn = data.aws_ssoadmin_permission_set.AWSAdministratorAccess.instance_arn
permission_set_arn = data.aws_ssoadmin_permission_set.AWSAdministratorAccess.arn
principal_id = data.aws_identitystore_group.DevOps.group_id
principal_type = "GROUP"
target_id = var.company_development_account_id
target_type = "AWS_ACCOUNT"
}
resource "aws_ssoadmin_account_assignment" "Admin_ProdEnv" {
instance_arn = data.aws_ssoadmin_permission_set.AWSAdministratorAccess.instance_arn
permission_set_arn = data.aws_ssoadmin_permission_set.AWSAdministratorAccess.arn
principal_id = data.aws_identitystore_group.DevOps.group_id
principal_type = "GROUP"
target_id = var.company_production_account_id
target_type = "AWS_ACCOUNT"
}
resource "aws_ssoadmin_account_assignment" "Admin_MasterEnv" {
instance_arn = data.aws_ssoadmin_permission_set.AWSAdministratorAccess.instance_arn
permission_set_arn = data.aws_ssoadmin_permission_set.AWSAdministratorAccess.arn
principal_id = data.aws_identitystore_group.DevOps.group_id
principal_type = "GROUP"
target_id = var.company_master_account_id
target_type = "AWS_ACCOUNT"
}
resource "aws_ssoadmin_account_assignment" "DevOps_DevEnv" {
instance_arn = aws_ssoadmin_permission_set.DevOps_DevEnv.instance_arn
permission_set_arn = aws_ssoadmin_permission_set.DevOps_DevEnv.arn
principal_id = data.aws_identitystore_group.DevOps.group_id
principal_type = "GROUP"
target_id = var.company_development_account_id
target_type = "AWS_ACCOUNT"
}
resource "aws_ssoadmin_account_assignment" "DevOps_ProdEnv" {
instance_arn = aws_ssoadmin_permission_set.DevOps_ProdEnv.instance_arn
permission_set_arn = aws_ssoadmin_permission_set.DevOps_ProdEnv.arn
principal_id = data.aws_identitystore_group.DevOps.group_id
principal_type = "GROUP"
target_id = var.company_production_account_id
target_type = "AWS_ACCOUNT"
}