File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,14 @@ resource "aws_iam_role_policy" "session_logging" {
139139 policy = join (" " , data. aws_iam_policy_document . session_logging . * . json )
140140}
141141
142+ resource "aws_iam_role_policy" "custom" {
143+ count = length (var. custom_policy_document ) > 0 ? 1 : 0
144+
145+ name = " ${ module . role_label . id } -${ var . custom_policy_name } "
146+ role = aws_iam_role. default . name
147+ policy = var. custom_policy_document
148+ }
149+
142150resource "aws_iam_instance_profile" "default" {
143151 name = module. role_label . id
144152 role = aws_iam_role. default . name
Original file line number Diff line number Diff line change @@ -212,3 +212,15 @@ variable "scale_in_protected_instances" {
212212 error_message = " scale_in_protected_instances must be one of Refresh, Ignore, or Wait"
213213 }
214214}
215+
216+ variable "custom_policy_document" {
217+ description = " JSON policy document for custom permissions to attach to the SSM Agent role. If not provided, no custom policy will be attached."
218+ type = string
219+ default = " "
220+ }
221+
222+ variable "custom_policy_name" {
223+ description = " Name for the custom policy. Only used if custom_policy_document is provided."
224+ type = string
225+ default = " custom-policy"
226+ }
You can’t perform that action at this time.
0 commit comments