I'm using gitlabci to deploy my chalice app and I would like to know how to use the chalice delete command to delete the app (the entire stack), again from my gitlabci. I can't use the chalice package because of s3_event issue, hence the use of chalice deploy in my CICD.
Can we for example get the name of cloudformation stack ? if so, I think use this
aws cloudformation delete-stack --stack-name my-stack
`
```yaml
stages:
chalice-deploy:
stage: deploy
image: python:3.7.4
script:
- pip3 install awscli chalice
- chalice deploy
artifacts:
paths:
- public
chalice-delete:
stage: stop
image: python:3.7.4
when: manual
script:
- pip3 install awscli chalice
- chalice delete ????
````
The chalice deploy command relies on a local state file to track what's been deployed. In order to support something like that the gitlabci workflow we'd need to be able to store the statefile in a remote location (similar to what terraform can do) which we don't currently support. One possible workaround is to use terraform to deploy your app.
The deployment state is kept under the .chalice folder IIRC, so you should be able to capture that directory as one of your artifacts in gitlab-ci and pass that on to your delete job.
Currently I use the artifact and it works, but I am thinking of using a common s3 bucket where i put a dev.json file after each deploy job.
So I don't think I need terraform; what do you think ?
`
```yaml
stages:
chalice-delete:
stage: stop
dependencies:
- chalice-deploy
script:
- cat .chalice/deployed/dev.json
- chalice delete
````
Concurrent builds may be a problem and S3's eventual consistency could also be problematic, but if Terraform is out of the question it seems like a potential workaround for now
Yep pulling in the .chalice directory like you've done should work, with the caveat that concurrent builds could be an issue. Thanks @jrbeilke for chiming in.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.