aws-cloudformation / aws-cloudformation/cfn-lint-visual-studio-code

Graph preview doesn't work after setting Role for lambda

Open
#440 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
289
Forks
170
PR merge metrics
No merged PRs in 30d

Description

The graph preview is failing to display, as soon as I set the `Role` Property on the Lambda Function.

IAM Role resource

```yml
IAMRoleLambdaRawFile:
Type: AWS::IAM::Role
Properties:
Path: /
RoleName: !Join
- "-"
- [ !Ref "AWS::Region", !Ref "AWS::StackName", "lambda-raw-file-role" ]
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
Policies:
- PolicyName: "root"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- 's3:*'
- 's3-object-lambda:*'
- "dynamodb:*"
- "iot:*"
Resource: "*"
```

Lambda Function resource

```yaml
LambdaSetupFileUpload:
Type: AWS::Lambda::Function
Properties:
FunctionName:
Ref: SetupFileUploadLambdaName
Handler: lambda_function.lambda_handler
Runtime: python3.12
Role: !GetAtt IAMRoleLambdaRawFile.Arn
Code:
S3Bucket: init-file-upload
S3Key: Bundle_FileUpload.zip
```

Commenting out or removing the "Role" in lambda function successfully makes a graph.

Same thing happens when adding a "DependsOn", so I'm guessing it's something to do with the connections?

extension version: 0.26.1

VSCode About Me

Version: 1.96.4 (system setup)
Commit: cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
Date: 2025-01-16T00:16:19.038Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19045

Python 3.8

Python pip package details

Name: cfn-lint
Version: 1.22.5
Summary: Checks CloudFormation templates for practices and behaviour that could potentially be improved
Home-page: https://github.com/aws-cloudformation/cfn-lint
Author: Kevin DeJong
Author-email: kddejong@amazon.com
License: MIT no attribution
Location: /home/netduma/.local/lib/python3.8/site-packages
Requires: aws-sam-translator, jsonpatch, networkx, pyyaml, regex, sympy, typing_extensions
Required-by:

Name: pydot
Version: 3.0.4
Summary: Python interface to Graphviz's Dot
Home-page: https://github.com/pydot/pydot
Author:
Author-email: Ero Carrera , Peter Nowee , Łukasz , "FeRD (Frank Dana)"
License: MIT
Location: /home/netduma/.local/lib/python3.8/site-packages
Requires: pyparsing
Required-by:

Edit:
Updating to python 3.12 hasn't helped.

Contributor guide

Open the contributing guide

Research direction

Reproduce the graph preview failure with the supplied CloudFormation template, first with the Lambda Role and then with DependsOn removed. Trace the extension's graph-preview handling of resource connections and compare the generated graph for the working and failing templates; done means Role and DependsOn no longer prevent a graph from displaying.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, vscode
Domain
cloud, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.