# Error: The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource name-of-role

**URL:** <https://forum.serverless.com/t/error-the-cloudformation-template-is-invalid-template-error-instance-of-fn-getatt-references-undefined-resource-name-of-role/11440>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, cloudformation, iam\
**Created:** [May 14, 2020, 9:18am UTC](https://forum.serverless.com/t/error-the-cloudformation-template-is-invalid-template-error-instance-of-fn-getatt-references-undefined-resource-name-of-role/11440 "2020-05-14T09:18:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dir101](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dir101](https://forum.serverless.com/u/dir101)\
**Post date:** [May 14, 2020, 9:18am UTC](https://forum.serverless.com/t/error-the-cloudformation-template-is-invalid-template-error-instance-of-fn-getatt-references-undefined-resource-name-of-role/11440/1 "2020-05-14T09:18:18Z")

</div>

I am trying to deploy a service to AWS using serverless framework and keep getting the following error: `Error: The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource dev-example`

Here are the relevant parts of my serverless.yml file:

```auto
service: example 

provider:
  name: aws
  runtime: python3.7
  memorySize: 128
  logRetentionInDays: 1
  timeout: 300 
  role: ${opt:stage}-${self:service}
  
  resources:
    Resources:
      dev-example:
        Type: AWS::IAM::Role
        Properties:
          RoleName: ${opt:stage}-${self:service}-role
          AssumeRolePolicyDocument:
            Version: '2020-05-13'
            Statement:
              - Effect: Allow
                Principal:
                  Service:
                    - lambda.amazonaws.com
                Action: 'sts:AssumeRole' 
          ManagedPolicyArns:
            - arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole
            - arn:aws:iam::aws:policy/AmazonRDSDataFullAccess
            - arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
            - arn:aws:iam::aws:policy/service-role/AWSLambdaRole
          Policies:
            - PolicyName: ${opt:stage}-${self:service}-policies
              PolicyDocument:
                Version: '2020-05-13'
                Statement:
                  - Effect: Allow
                    Action: 
                      - logs:CreateLogGroups
                      - logs:CreateLogStream
                      - logs:PutLogEvents
                    Resource:
                      - 'Fn::Join':
                        - ':'
                        -
                          - 'arn:aws:logs'
                          - Ref: 'AWS::Region'
                          - Ref: 'AWS::AccountId'
                          - 'log-group:/aws/lambda/*:*:*' 

```

Any insights as to what is causing this error would be great!

The resources format for the custom IAM Role was created using the template here: [https://www.serverless.com/framework/docs/providers/aws/guide/iam/](https://www.serverless.com/framework/docs/providers/aws/guide/iam/)
