File tree 27 files changed +345
-88
lines changed
aws-iam-role-cloudfront-poweruser
aws-iam-role-ec2-poweruser
aws-iam-role-ecs-poweruser
aws-iam-role-route53domains-poweruser
aws-iam-role-security-audit
27 files changed +345
-88
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ This module will create a role which is granted poweruser control over AWS Cloud
10
10
| iam\_ path | | string | ` "/" ` | no |
11
11
| role\_ name | Name of the role to create | string | n/a | yes |
12
12
| s3\_ bucket\_ prefixes | Limits role permissions to buckets with specific prefixes. Empty for all buckets. | list | ` <list> ` | no |
13
- | source\_ account\_ id | AWS Account that can assume this role. | string | n/a | yes |
13
+ | source\_ account\_ id | The source AWS account to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
14
+ | saml\_ idp\_ arn | The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
14
15
15
16
## Outputs
16
17
Original file line number Diff line number Diff line change 1
1
data "aws_iam_policy_document" "assume-role" {
2
- statement {
3
- principals {
4
- type = " AWS"
5
- identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
2
+ dynamic "statement" {
3
+ for_each = compact ([var . source_account_id ])
4
+ content {
5
+ principals {
6
+ type = " AWS"
7
+ identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
8
+ }
9
+ actions = [" sts:AssumeRole" ]
6
10
}
11
+ }
12
+
13
+ dynamic "statement" {
14
+ for_each = compact ([var . saml_idp_arn ])
15
+ content {
16
+ principals {
17
+ type = " Federated"
18
+ identifiers = [" ${ var . saml_idp_arn } " ]
19
+ }
7
20
8
- actions = [" sts:AssumeRole" ]
21
+ actions = [" sts:AssumeRoleWithSAML" ]
22
+
23
+ condition {
24
+ test = " StringEquals"
25
+ variable = " SAML:aud"
26
+ values = [" https://signin.aws.amazon.com/saml" ]
27
+ }
28
+ }
9
29
}
10
30
}
11
31
Original file line number Diff line number Diff line change 1
- variable "source_account_id" {
2
- type = " string"
3
- description = " AWS Account that can assume this role."
4
- }
5
-
6
1
variable "role_name" {
7
2
type = " string"
8
3
description = " Name of the role to create"
@@ -21,3 +16,15 @@ variable "iam_path" {
21
16
type = " string"
22
17
default = " /"
23
18
}
19
+
20
+ variable "source_account_id" {
21
+ type = " string"
22
+ default = " "
23
+ description = " The source AWS account to establish a trust relationship. Ignored if empty or not provided."
24
+ }
25
+
26
+ variable "saml_idp_arn" {
27
+ type = " string"
28
+ default = " "
29
+ description = " The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided."
30
+ }
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ module "group" {
23
23
| ------| -------------| :----:| :-----:| :-----:|
24
24
| iam\_ path | The IAM path to put this role in. | string | ` "/" ` | no |
25
25
| role\_ name | The name of the role. | string | n/a | yes |
26
- | source\_ account\_ id | The AWS account id that should be able to assume this role. | string | n/a | yes |
26
+ | source\_ account\_ id | The source AWS account to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
27
+ | saml\_ idp\_ arn | The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
27
28
28
29
## Outputs
29
30
Original file line number Diff line number Diff line change 1
1
data "aws_iam_policy_document" "assume-role" {
2
- statement {
3
- principals {
4
- type = " AWS"
5
- identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
2
+ dynamic "statement" {
3
+ for_each = compact ([var . source_account_id ])
4
+ content {
5
+ principals {
6
+ type = " AWS"
7
+ identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
8
+ }
9
+ actions = [" sts:AssumeRole" ]
6
10
}
11
+ }
12
+
13
+ dynamic "statement" {
14
+ for_each = compact ([var . saml_idp_arn ])
15
+ content {
16
+ principals {
17
+ type = " Federated"
18
+ identifiers = [" ${ var . saml_idp_arn } " ]
19
+ }
7
20
8
- actions = [" sts:AssumeRole" ]
21
+ actions = [" sts:AssumeRoleWithSAML" ]
22
+
23
+ condition {
24
+ test = " StringEquals"
25
+ variable = " SAML:aud"
26
+ values = [" https://signin.aws.amazon.com/saml" ]
27
+ }
28
+ }
9
29
}
10
30
}
11
31
Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ variable "iam_path" {
9
9
}
10
10
11
11
variable "source_account_id" {
12
- description = " The AWS account id that should be able to assume this role."
13
12
type = " string"
13
+ default = " "
14
+ description = " The source AWS account to establish a trust relationship. Ignored if empty or not provided."
15
+ }
16
+
17
+ variable "saml_idp_arn" {
18
+ type = " string"
19
+ default = " "
20
+ description = " The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided."
14
21
}
Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ module "ec2-poweruser" {
25
25
| ------| -------------| :----:| :-----:| :-----:|
26
26
| iam\_ path | | string | ` "/" ` | no |
27
27
| role\_ name | | string | n/a | yes |
28
- | source\_ account\_ id | | string | n/a | yes |
28
+ | source\_ account\_ id | The source AWS account to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
29
+ | saml\_ idp\_ arn | The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
29
30
30
31
## Outputs
31
32
Original file line number Diff line number Diff line change 1
1
data "aws_iam_policy_document" "assume-role" {
2
- statement {
3
- principals {
4
- type = " AWS"
5
- identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
2
+ dynamic "statement" {
3
+ for_each = compact ([var . source_account_id ])
4
+ content {
5
+ principals {
6
+ type = " AWS"
7
+ identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
8
+ }
9
+ actions = [" sts:AssumeRole" ]
6
10
}
11
+ }
12
+
13
+ dynamic "statement" {
14
+ for_each = compact ([var . saml_idp_arn ])
15
+ content {
16
+ principals {
17
+ type = " Federated"
18
+ identifiers = [" ${ var . saml_idp_arn } " ]
19
+ }
7
20
8
- actions = [" sts:AssumeRole" ]
21
+ actions = [" sts:AssumeRoleWithSAML" ]
22
+
23
+ condition {
24
+ test = " StringEquals"
25
+ variable = " SAML:aud"
26
+ values = [" https://signin.aws.amazon.com/saml" ]
27
+ }
28
+ }
9
29
}
10
30
}
11
31
Original file line number Diff line number Diff line change 1
- variable "source_account_id" {
2
- type = " string"
3
- }
4
-
5
1
variable "role_name" {
6
2
type = " string"
7
3
}
@@ -10,3 +6,15 @@ variable "iam_path" {
10
6
type = " string"
11
7
default = " /"
12
8
}
9
+
10
+ variable "source_account_id" {
11
+ type = " string"
12
+ default = " "
13
+ description = " The source AWS account to establish a trust relationship. Ignored if empty or not provided."
14
+ }
15
+
16
+ variable "saml_idp_arn" {
17
+ type = " string"
18
+ default = " "
19
+ description = " The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided."
20
+ }
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ module "ec2-poweruser" {
24
24
| ------| -------------| :----:| :-----:| :-----:|
25
25
| iam\_ path | | string | ` "/" ` | no |
26
26
| role\_ name | | string | n/a | yes |
27
- | source\_ account\_ id | | string | n/a | yes |
27
+ | source\_ account\_ id | The source AWS account to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
28
+ | saml\_ idp\_ arn | The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
28
29
29
30
## Outputs
30
31
Original file line number Diff line number Diff line change 1
1
data "aws_iam_policy_document" "assume-role" {
2
- statement {
3
- principals {
4
- type = " AWS"
5
- identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
2
+ dynamic "statement" {
3
+ for_each = compact ([var . source_account_id ])
4
+ content {
5
+ principals {
6
+ type = " AWS"
7
+ identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
8
+ }
9
+ actions = [" sts:AssumeRole" ]
6
10
}
11
+ }
12
+
13
+ dynamic "statement" {
14
+ for_each = compact ([var . saml_idp_arn ])
15
+ content {
16
+ principals {
17
+ type = " Federated"
18
+ identifiers = [" ${ var . saml_idp_arn } " ]
19
+ }
7
20
8
- actions = [" sts:AssumeRole" ]
21
+ actions = [" sts:AssumeRoleWithSAML" ]
22
+
23
+ condition {
24
+ test = " StringEquals"
25
+ variable = " SAML:aud"
26
+ values = [" https://signin.aws.amazon.com/saml" ]
27
+ }
28
+ }
9
29
}
10
30
}
11
31
Original file line number Diff line number Diff line change 1
- variable "source_account_id" {
2
- type = " string"
3
- }
4
-
5
1
variable "role_name" {
6
2
type = " string"
7
3
}
@@ -10,3 +6,15 @@ variable "iam_path" {
10
6
type = " string"
11
7
default = " /"
12
8
}
9
+
10
+ variable "source_account_id" {
11
+ type = " string"
12
+ default = " "
13
+ description = " The source AWS account to establish a trust relationship. Ignored if empty or not provided."
14
+ }
15
+
16
+ variable "saml_idp_arn" {
17
+ type = " string"
18
+ default = " "
19
+ description = " The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided."
20
+ }
Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ Creates a role useful for running `terraform plan` in CI jobs.
9
9
| ------| -------------| :----:| :-----:| :-----:|
10
10
| iam\_ path | | string | ` "/" ` | no |
11
11
| role\_ name | | string | ` "infraci" ` | no |
12
- | source\_ account\_ id | | string | n/a | yes |
13
12
| terraform\_ state\_ lock\_ dynamodb\_ arns | "A list of unique identifiers (ARNs) of state file DynamoDB tables" | string | ` [] ` | yes |
13
+ | source\_ account\_ id | The source AWS account to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
14
+ | saml\_ idp\_ arn | The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
14
15
15
16
## Outputs
16
17
Original file line number Diff line number Diff line change 1
1
data "aws_iam_policy_document" "assume-role" {
2
- statement {
3
- principals {
4
- type = " AWS"
5
- identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
2
+ dynamic "statement" {
3
+ for_each = compact ([var . source_account_id ])
4
+ content {
5
+ principals {
6
+ type = " AWS"
7
+ identifiers = [" arn:aws:iam::${ var . source_account_id } :root" ]
8
+ }
9
+ actions = [" sts:AssumeRole" ]
6
10
}
11
+ }
7
12
8
- actions = [" sts:AssumeRole" ]
13
+ dynamic "statement" {
14
+ for_each = compact ([var . saml_idp_arn ])
15
+ content {
16
+ principals {
17
+ type = " Federated"
18
+ identifiers = [" ${ var . saml_idp_arn } " ]
19
+ }
20
+
21
+ actions = [" sts:AssumeRoleWithSAML" ]
22
+
23
+ condition {
24
+ test = " StringEquals"
25
+ variable = " SAML:aud"
26
+ values = [" https://signin.aws.amazon.com/saml" ]
27
+ }
28
+ }
9
29
}
10
30
}
11
31
Original file line number Diff line number Diff line change 1
- variable "source_account_id" {
2
- type = " string"
3
- }
4
-
5
1
variable "role_name" {
6
2
default = " infraci"
7
3
}
@@ -15,3 +11,15 @@ variable "terraform_state_lock_dynamodb_arns" {
15
11
default = []
16
12
description = " ARNs of the state file DynamoDB tables"
17
13
}
14
+
15
+ variable "source_account_id" {
16
+ type = " string"
17
+ default = " "
18
+ description = " The source AWS account to establish a trust relationship. Ignored if empty or not provided."
19
+ }
20
+
21
+ variable "saml_idp_arn" {
22
+ type = " string"
23
+ default = " "
24
+ description = " The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided."
25
+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ module "group" {
11
11
# defaults to "poweruser"
12
12
role_name = "..."
13
13
14
- # The id of the other AWS account that can assume this role.
14
+ # The id of the other AWS account that can assume this role.
15
15
source_account_id = "..."
16
16
}
17
17
```
@@ -23,7 +23,8 @@ module "group" {
23
23
| ------| -------------| :----:| :-----:| :-----:|
24
24
| iam\_ path | | string | ` "/" ` | no |
25
25
| role\_ name | | string | ` "poweruser" ` | no |
26
- | source\_ account\_ id | | string | n/a | yes |
26
+ | source\_ account\_ id | The source AWS account to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
27
+ | saml\_ idp\_ arn | The AWS SAML IDP arn to establish a trust relationship. Ignored if empty or not provided. | string | '' | no |
27
28
28
29
## Outputs
29
30
You can’t perform that action at this time.
0 commit comments