Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ resource "aws_iam_role_policy" "session_logging" {
policy = join("", data.aws_iam_policy_document.session_logging.*.json)
}

resource "aws_iam_role_policy" "custom" {
count = length(var.custom_policy_document) > 0 ? 1 : 0

name = "${module.role_label.id}-${var.custom_policy_name}"
role = aws_iam_role.default.name
policy = var.custom_policy_document
}

resource "aws_iam_instance_profile" "default" {
name = module.role_label.id
role = aws_iam_role.default.name
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,15 @@ variable "scale_in_protected_instances" {
error_message = "scale_in_protected_instances must be one of Refresh, Ignore, or Wait"
}
}

variable "custom_policy_document" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this updating the README on commit? Do we need to add the trunk action to this repo maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I didn't init Trunk in this repo locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the Git hook didn't block it.

description = "JSON policy document for custom permissions to attach to the SSM Agent role. If not provided, no custom policy will be attached."
type = string
default = ""
}

variable "custom_policy_name" {
description = "Name for the custom policy. Only used if custom_policy_document is provided."
type = string
default = "custom-policy"
}