File tree 4 files changed +21
-15
lines changed
4 files changed +21
-15
lines changed Original file line number Diff line number Diff line change 16
16
17
17
| Name | Source | Version |
18
18
| ------| --------| ---------|
19
- | <a name =" module_aqua_cspm_role " ></a > [ aqua\_ cspm\_ role] ( #module\_ aqua\_ cspm\_ role ) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | ~ > 5.9.0 |
20
19
| <a name =" module_kms " ></a > [ kms] ( #module\_ kms ) | terraform-aws-modules/kms/aws | ~ > 1.5.0 |
21
20
| <a name =" module_lambda " ></a > [ lambda] ( #module\_ lambda ) | terraform-aws-modules/lambda/aws | ~ > 4.10.1 |
22
21
| <a name =" module_lambda_role " ></a > [ lambda\_ role] ( #module\_ lambda\_ role ) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | ~ > 5.9.0 |
27
26
| ------| ------|
28
27
| [ aws_iam_policy.aqua_cspm_lambda] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy ) | resource |
29
28
| [ aws_iam_policy.aqua_cspm_supplemental] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy ) | resource |
29
+ | [ aws_iam_role.aqua_cspm] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role ) | resource |
30
+ | [ aws_iam_role_policy_attachment.aqua_cspm] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment ) | resource |
30
31
| [ aws_lambda_invocation.external_id] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_invocation ) | resource |
31
32
| [ aws_lambda_invocation.onboarding] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_invocation ) | resource |
32
33
| [ aws_secretsmanager_secret.aqua_cspm_secret] ( https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret ) | resource |
Original file line number Diff line number Diff line change @@ -32,23 +32,23 @@ resource "aws_iam_policy" "aqua_cspm_supplemental" {
32
32
policy = data. aws_iam_policy_document . aqua_cspm_supplemental . json
33
33
}
34
34
35
- module "aqua_cspm_role" {
36
- source = " terraform-aws-modules/iam/aws//modules/iam-assumable-role"
37
- version = " ~> 5.9.0"
38
-
39
- create_role = true
40
-
41
- role_name = " ${ local . name_prefix } -role"
42
- role_description = " Assumable Role of Aqua SaaS"
35
+ resource "aws_iam_role" "aqua_cspm" {
36
+ name = " ${ local . name_prefix } -role"
37
+ description = " Assumable Role of Aqua SaaS"
43
38
44
- custom_role_trust_policy = data. aws_iam_policy_document . aqua_cspm_custom_trust . json
39
+ path = " /"
40
+ max_session_duration = " 3600"
45
41
46
- custom_role_policy_arns = [
47
- " arn:aws:iam::aws:policy/SecurityAudit" ,
48
- aws_iam_policy . aqua_cspm_supplemental . arn ,
49
- ]
42
+ assume_role_policy = data. aws_iam_policy_document . aqua_cspm_custom_trust . json
50
43
51
44
depends_on = [
52
45
aws_lambda_invocation . external_id ,
53
46
]
54
47
}
48
+
49
+ resource "aws_iam_role_policy_attachment" "aqua_cspm" {
50
+ count = length (local. aqua_cspm_role_policy_arns )
51
+
52
+ policy_arn = element (local. aqua_cspm_role_policy_arns , count. index )
53
+ role = aws_iam_role. aqua_cspm . name
54
+ }
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ resource "aws_lambda_invocation" "onboarding" {
36
36
Secret = aws_secretsmanager_secret.aqua_cspm_secret.id,
37
37
ExtId = local.external_id,
38
38
Group = var.aqua_group_name,
39
- RoleArn = module.aqua_cspm_role.iam_role_arn ,
39
+ RoleArn = aws_iam_role.aqua_cspm.arn ,
40
40
AccId = data.aws_caller_identity.current.account_id
41
41
},
42
42
LogicalResourceId = " OnboardingInvoke"
Original file line number Diff line number Diff line change 5
5
6
6
external_id = jsondecode (aws_lambda_invocation. external_id . result )[" data" ]
7
7
public_ip = " 3.231.74.65/32"
8
+
9
+ aqua_cspm_role_policy_arns = [
10
+ " arn:aws:iam::aws:policy/SecurityAudit" ,
11
+ aws_iam_policy . aqua_cspm_supplemental . arn ,
12
+ ]
8
13
}
You can’t perform that action at this time.
0 commit comments