Skip to content

Conversation

robert-matusewicz
Copy link

Description

This addresses issue #164
The current implementation of the IAM policy for pipes that use MSK as a source is incorrect. It restricts the following actions:

  • ec2:DescribeNetworkInterfaces
  • ec2:DescribeSecurityGroups
  • ec2:DescribeSubnets
  • ec2:DescribeVpcs
  • ec2:CreateNetworkInterface
  • ec2:DeleteNetworkInterface

to the MSK cluster ARN, but all of them require a wildcard resource ("*").

I am aiming to fix this issue with the change in this PR.

In addition, I added an example of a pipe with MSK as a source and a sqs as a target.

Motivation and Context

The correct IAM permissions are not valid for a pipe with MSK source.

Breaking Changes

No

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

The ec2:* actions accept only "*" as a resource.

Added example of pipes with MSK as a source and sqs as a target.
Copy link

github-actions bot commented Sep 3, 2025

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added stale and removed stale labels Sep 3, 2025
Copy link

github-actions bot commented Oct 4, 2025

This PR has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this PR will be closed in 10 days

@github-actions github-actions bot added the stale label Oct 4, 2025
sid = replace(replace(title(replace("${each.key}${title(statement.key)}", "/[_-]/", " ")), " ", ""), "/[^0-9A-Za-z]*/", "")
actions = local.aws_service_policies[statement.key]["actions"]
resources = tolist(statement.value)
resources = try(local.aws_service_policies[statement.key].resources, tolist(statement.value))
Copy link
Member

Choose a reason for hiding this comment

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

what is the reason for this change?

####################
# MSK
####################
resource "aws_vpc" "main" {
Copy link
Member

Choose a reason for hiding this comment

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

lets use our modules to show this https://github.com/terraform-aws-modules/terraform-aws-msk-kafka-cluster/blob/master/examples/basic/main.tf

also, lets add a variable to enable/disable the MSK resources/integration. provisioning a cluster takes quite a bit of time 😅

@github-actions github-actions bot removed the stale label Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants