aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.5k stars 419 forks source link

Do not allow user to delete Lambda Functions associated with CloudFormation stacks #502

Open awschristou opened 5 years ago

awschristou commented 5 years ago

Describe the bug

It should not be possible to delete a Lambda Function that belongs to a CloudFormation stack. This was overlooked during #190.

To Reproduce

  1. Create a CloudFormation Stack that contains a Lambda Function
  2. Go to the AWS Explorer
  3. Open the CloudFormation Stack and right click on the function. Notice there is no Delete menu item (good)
  4. Locate the "Lambda Functions" node for the same function, and right click on it. Notice there is a Delete menu item (bad). Delete the Lambda Function
  5. Function gets deleted

Expected behavior

It should not be possible to delete the function.

Desktop (please complete the following information):

awschristou commented 5 years ago

Lambda Function tags can be queried for the presence of the following:

aws:cloudformation:stack-name
aws:cloudformation:stack-id
aws:cloudformation:logical-id