Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated managed policy arn ref #498

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ env/
.vscode
*.code-workspace
*.sha256

terraform.tfstate
terraform.tfstate.backup
9 changes: 7 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,18 @@ resource "aws_iam_role" "this" {
}
)

managed_policy_arns = concat(["arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"], var.instance_profile_policies)

tags = merge(local.tags, {
Name = "${var.iam_resource_names_prefix}-role-${var.name}"
})
}

# IAM role policy attachment
resource "aws_iam_role_policy_attachment" "this" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks all good, but calling it 'this' can we have a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think if we change that it'd make sense to do a bigger overhaul of the module as I was just following the naming convention applied to most of the resources in this module. Perhaps that'd be a separate PR?

Also that could possibly cause all users upgrading to need to rebuild their resources just for the name change.

count = length(concat(["arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"], var.instance_profile_policies))
role = aws_iam_role.this.name
policy_arn = element(concat(["arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"], var.instance_profile_policies), count.index)
}

data "aws_iam_policy_document" "ssm_params_and_secrets" {
count = var.ssm_parameters != null || var.secretsmanager_secrets != null ? 1 : 0
dynamic "statement" {
Expand Down
Loading