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

How to add conditions to the IAM role statements for a specific function #154

Open
s1mrankaur opened this issue Jun 24, 2024 · 0 comments
Open

Comments

@s1mrankaur
Copy link

s1mrankaur commented Jun 24, 2024

Here's a basic example of what I'd like to be able to do:

`service: my-service

provider:
name: aws
runtime: nodejs18.x

plugins:

serverless-iam-roles-per-function
functions:
myFunction:
handler: handler.myFunction
iamRoleStatements:

  • Effect: Allow
    Action:
  • dynamodb:Query
  • dynamodb:Scan
    Resource: arn:aws:dynamodb:us-east-1:123456789012:table/my-table
    Condition:
    StringEquals:
    "dynamodb:LeadingKeys": "userId"

secondFunction:
handler: handler.secondFunction
iamRoleStatements:

  • Effect: Allow
    Action:
  • dynamoDB:UpdateItem
    Resource: arn:aws:dynamodb:us-east-1:123456789012:table/my-table
    Condition:
    ForAllValues:StringNotLike:
    "dynamodb:Attributes":[
    "FreeGamesAvailable",
    "BossLevelUnlocked"
    ]

anotherFunction:
handler: handler.anotherFunction
iamRoleStatements:

  • Effect: Allow
    Action:
  • s3:GetObject
    Resource: arn:aws:s3:::my-bucket/*
    Condition:
    IpAddress:
    "aws:SourceIp": "203.0.113.0/24"
    `

If this isn't supported currently by the package, what are my options?

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

No branches or pull requests

1 participant