I have this issue: I have deployed a function with CF that is build with the aws cloudformation package command. The first deployment works perfect. But when it try to update the code nothing happens. This is what I do:
- Save changes to my local code and and CF and run aws cloudformation package (aws cloudformation package --template-file mycf.yml --s3-bucket mybucket --output-template-file packaged-mycf.yml --profile myprofile)
- I see in the packaged file that where is a new path under CodeUri (CodeUri: s3://mybucket/319bd03cb3cc8d50ceb80e52bf51c53c)
- I deploy the update (I do it in the console) I see under update that where is updates to the function
- The CF events says update to function is complete
- I go to code, the same old code nothing has changed
Have anyone else experienced the same? I have tried to rename the CF file, script file and the packaged CF file. But it still get the same result. Does anyone here have an ide on what i may try?
This is how the unpackaged function part of the CF looks like:
CRFunction:
Type: AWS::Serverless::Function
Properties:
Description: Convert IAM Policy into SCP
Handler: scpfunction.lambda_handler
Runtime: python3.9
Timeout: 30
MemorySize: 128
FunctionName: !Sub SCP-Function-${SCPName}
CodeUri: src/
Environment:
Variables:
SCPName: !Ref SCPName
Policy: !Ref IAMPolicyToConvertToSCP
OUs: !Ref OUs
Description: !Ref Description
Policies:
Statement:
- Effect: Allow
Action:
- organizations:CreatePolicy
- organizations:AttachPolicy
- organizations:List*
- iam:get*
Resource: '*'
CodePudding user response:
Have anyone else experienced the same?
That's how it works by design. Changes to the source code are not detected. You have to change either 
CodePudding user response:
I got this solved. It was not an issue related to AWS. After restarting VisualStudioCode I got the deployment to work. So it had to do with some local caching or something. Really weird never experienced anything like that before.
