chalice
chalice copied to clipboard
Can't update deployed API if missing lambda_arn from config
I am setting up Chalice deployment using CodeBuild and I have problem that first deployment works but on second one I get An error occurred (BadRequestException) when calling the PutIntegration operation: Invalid lambda function if Lambda deployed in first time exists.
So if I belive Chalice fails to deploy if it is missing lambda_arn in config file, and because our build always starts from fresh and don't want to put environment specific lambda_arn into repository it will fail.
I think I could add environment dependant configuration files into git and have CodeBuild copy correct one into right place. But would prefer if Chalice could update deployed lambda even without this info, either automatically or by requiring some separate command to load this information from environment it is deploying into. Or have some parameter where you can cleanly give environment config to use.
Adding a parameter to chalice deploy should be pretty straightforward. Were you thinking something like this?
chalice deploy --config deploy-config.json
And deploy-config.json would look like:
{"lambda_arn": "arn:12345:..."}
or by requiring some separate command to load this information from environment it is deploying into.
I'm not sure what you mean here. Could you give an example of how this would work?
That would be ok. It would simplify our current solution little bit.
But best would be if Chalice could load arn info from environment it is going to deploy, so if have once deployed it into my AWS account it would know what to do even without me telling what lambda_arn is. So something like this following that would first check if there is existing Lambda from this Chalice project deployed into AWS environment, and if is then update that.
chalice deploy --refresh
Difference is that if lambda_arn is in config file then when I deploy to new environment I have to write that arn to config file because our CI environment is wiped out every time.
So something like this following that would first check if there is existing Lambda from this Chalice project deployed into AWS environment, and if is then update that.
This is what the arn is. How do I check this if I don't have the arn? Just check for a function with the same name and hope its not an accidental collision? I would much rather be explicit about what resources chalice is maintaining.
I suppose you could tag all the resources with your application name and figure it out from that.
But really if you are using a CI system, it would make more sense to use the chalice package command at the end and deploy from that since then you have a cloudformation stack that keeps track of all your resources.
I would most likely use tags, generate some id on chalice project init and use that.
But have to look into that package option for next project, as I don't think it was available when we started our previous one ...at least chalice version I have installed doesn't know about it. We don't usually use CloudFormation but I think we could easily integrate it with Terraform/Ansible.
I have the same issue, I want this to run from a CI workflow where I don't want to have to keep config.json up to date manually...