# Unresolved resource dependencies IamRoleLambdaExecution

**URL:** <https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [April 5, 2017, 10:59am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638 "2017-04-05T10:59:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![KIVagant](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/kivagant/32/570_2.png) [@KIVagant](https://forum.serverless.com/u/KIVagant)\
**Post date:** [April 5, 2017, 10:59am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/1 "2017-04-05T10:59:10Z")

</div>

Hello.

I have strange problem with IAM resource: [https://serverless.com/framework/docs/providers/aws/guide/iam/](https://serverless.com/framework/docs/providers/aws/guide/iam/)

I have a function and for this func I adding the role: `ddbElasticsearchBridge`  
Below in the “resources \> Resources” section I’ve added this role.

```auto
functions:
  DDBtoES:
    handler: dynamodb.lambda_handler
    role: ddbElasticsearchBridge
    ...

resources:
  Resources:
    ddbElasticsearchBridge:
      Type: AWS::IAM::Role
      Properties:
        Path: /
        RoleName: ddb-elasticsearch-bridge
        AssumeRolePolicyDocument:
          Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - lambda.amazonaws.com
              Action: sts:AssumeRole
        ManagedPolicyArns:
          - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
        Policies:
          - PolicyName: DynamoRead
            PolicyDocument:
              Version: '2012-10-17'
              Statement:
                - Effect: Allow
                  Action:
                    - dynamodb:DescribeStream
                    - dynamodb:GetRecords
                    - dynamodb:GetShardIterator
                  Resource: arn:aws:dynamodb:us-east-1:12345678:table/mytablename/stream/2017-04-04T23:34:00.359

```

But I always getting this error:

```auto
Template format error: Unresolved resource dependencies
[IamRoleLambdaExecution] in the Resources block of the template

```

What I’m doing wrong? The same problem I have if I placing ‘role’ reference to the ‘provider’ section.

---

<div class="post-metadata">

**Author:** ![tobyhede](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tobyhede/32/283_2.png) [@tobyhede](https://forum.serverless.com/u/tobyhede)\
**Post date:** [April 20, 2017, 6:23am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/2 "2017-04-20T06:23:54Z")

</div>

Just ran into the same thing, did you ever find a resolution?

---

<div class="post-metadata">

**Author:** ![rowanu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rowanu/32/75_2.png) [@rowanu](https://forum.serverless.com/u/rowanu)\
**Post date:** [April 21, 2017, 12:05am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/3 "2017-04-21T00:05:03Z")

</div>

I haven’t had the error personally, but sounds like you need to give it the old `sls deploy --noDeploy` and check out the generated template and see what’s doing.

Do you have other functions in your service? Ones that use the default role (i.e. `IamRoleLambdaExecution`)? Maybe because it’s not being used it’s not appearing in the generated template, but it is still being referenced as a dependency?

---

<div class="post-metadata">

**Author:** ![tobyhede](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tobyhede/32/283_2.png) [@tobyhede](https://forum.serverless.com/u/tobyhede)\
**Post date:** [April 21, 2017, 12:45am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/4 "2017-04-21T00:45:37Z")

</div>

For me this happened adding a custom role to a function with a kinesis event.

The EventSourceMapping has a dependency on the baked-in role, which is causing the error.

“PopEventSourceMappingKinesisKinesis”: {  
“Type”: “AWS::Lambda::EventSourceMapping”,  
“DependsOn”: “IamRoleLambdaExecution”,  
… etc etc  
}

It might be a bug in the mapping generation.

---

<div class="post-metadata">

**Author:** ![rowanu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rowanu/32/75_2.png) [@rowanu](https://forum.serverless.com/u/rowanu)\
**Post date:** [April 21, 2017, 1:16am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/5 "2017-04-21T01:16:48Z")

</div>

Is the `IamRoleLambdaExecution` resource still present in the template?

It looks like [the dependency on `IamRoleLambdaExecution` is hard-coded](https://github.com/serverless/serverless/blob/master/lib/plugins/aws/package/compile/events/stream/index.js#L122).

Open an issue?

---

<div class="post-metadata">

**Author:** ![tobyhede](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tobyhede/32/283_2.png) [@tobyhede](https://forum.serverless.com/u/tobyhede)\
**Post date:** [April 21, 2017, 1:31am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/6 "2017-04-21T01:31:43Z")

</div>

Yep.

> <https://github.com/tobyhede/serverless/blob/f173630009528c4c53870c98e52dac7d8dff83d4/lib/plugins/aws/deploy/compile/events/stream/index.js#L122>

Will open.

---

<div class="post-metadata">

**Author:** ![tobyhede](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/tobyhede/32/283_2.png) [@tobyhede](https://forum.serverless.com/u/tobyhede)\
**Post date:** [April 21, 2017, 1:59am UTC](https://forum.serverless.com/t/unresolved-resource-dependencies-iamrolelambdaexecution/1638/7 "2017-04-21T01:59:26Z")

</div>

Issue and PR.

[https://github.com/serverless/serverless/issues/3499](https://github.com/serverless/serverless/issues/3499)  
[https://github.com/serverless/serverless/pull/3500](https://github.com/serverless/serverless/pull/3500)
