File tree 5 files changed +10
-7
lines changed
5 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ module "common_provider_example" {
13
13
repository = " appvia/something"
14
14
15
15
// Set the permission boundary for both the read-only and read-write role
16
- permission_boundary_arn = " arn:aws:iam::aws:policy/ AdministratorAccess"
16
+ permission_boundary = " AdministratorAccess"
17
17
18
18
// List of policy ARNs to attach to the read-only role
19
19
read_only_policy_arns = [
Original file line number Diff line number Diff line change
1
+
2
+ # # Retrieve the current AWS account identity
1
3
data "aws_caller_identity" "current" {}
4
+ # # Retrieve the current AWS region
2
5
data "aws_region" "current" {}
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ locals {
24
24
subject_tag_mapping = " project_path:{repo}:ref_type:{type}:ref:{ref}"
25
25
}
26
26
}
27
+ # The full ARN of the permission boundary to attach to the role
28
+ permission_boundary_arn = format (" arn:aws:iam::%s:policy/%s" , data. aws_caller_identity . current . account_id , var. permission_boundary )
27
29
}
28
30
29
31
locals {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ resource "aws_iam_role" "ro" {
44
44
45
45
force_detach_policies = var. force_detach_policies
46
46
max_session_duration = var. read_only_max_session_duration
47
- permissions_boundary = var . permission_boundary_arn
47
+ permissions_boundary = local . permission_boundary_arn
48
48
49
49
dynamic "inline_policy" {
50
50
for_each = var. read_only_inline_policies
@@ -119,7 +119,7 @@ resource "aws_iam_role" "rw" {
119
119
120
120
force_detach_policies = var. force_detach_policies
121
121
max_session_duration = var. read_write_max_session_duration
122
- permissions_boundary = var . permission_boundary_arn
122
+ permissions_boundary = local . permission_boundary_arn
123
123
124
124
dynamic "inline_policy" {
125
125
for_each = var. read_write_inline_policies
Original file line number Diff line number Diff line change @@ -104,14 +104,12 @@ variable "force_detach_policies" {
104
104
description = " Flag to force detachment of policies attached to the IAM role."
105
105
}
106
106
107
- variable "permission_boundary_arn " {
107
+ variable "permission_boundary " {
108
108
type = string
109
- default = null
110
- description = " The ARN of the policy that is used to set the permissions boundary for the IAM role"
109
+ description = " The name of the policy that is used to set the permissions boundary for the IAM role"
111
110
}
112
111
113
112
variable "tags" {
114
113
type = map (string )
115
- default = {}
116
114
description = " Tags to apply resoures created by this module"
117
115
}
You can’t perform that action at this time.
0 commit comments