-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmaster_user.tf
55 lines (47 loc) · 1.09 KB
/
master_user.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
variable "master_account_profile" {
type = "string"
}
provider "aws" {
profile = "${var.master_account_profile}"
region = "us-east-1"
}
resource "aws_iam_user" "okta" {
name = "svc_okta"
}
resource "aws_iam_access_key" "okta" {
user = "${aws_iam_user.okta.name}"
}
resource "aws_iam_user_policy" "okta_policy" {
name = "access_to_remote_accounts"
user = "${aws_iam_user.okta.name}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:GetAccountSummary",
"iam:ListRoles",
"iam:ListAccountAliases",
"iam:GetUser",
"sts:AssumeRole"
],
"Resource": "*"
}
]
}
EOF
}
data "aws_caller_identity" "current" {}
module "alpha_account" {
master_account_id = "${data.aws_caller_identity.current.account_id}"
source = "modules/okta_access"
profile = "alpha_account"
}
output "access_key" {
value = "${aws_iam_access_key.okta.id}"
}
output "secret_key" {
value = "${aws_iam_access_key.okta.secret}"
}