When I update a RestApi resource using CloudFormation update-stack, it does not update the corresponding Deployment resource.
My initial stack looks like this
Resources :
RestApi
/create
/delete
Deployment
DependsOn = RestApi
stage = latest
I updated the stack looks like this
Resources :
RestApi
/create
/delete
/update
Deployment
DependsOn = RestApi
StageName = latest
Using AWS cloudformation update-stack the RestApi is updated but deployment is not updated. I have to manually went in Console and Redeploy the API with the same StageName. Is it a known issue?
In the AWS CloudFormation console , from the list of stacks, select the running stack that you want to update. In the stack details pane, choose Update. If you haven't modified the stack template, select Use current template, and then choose Next.
AWS CloudFormation updates the resource without disrupting operation of that resource and without changing the resource's physical ID. For example, if you update certain properties on an AWS::CloudTrail::Trail resource, AWS CloudFormation updates the trail without disruption.
When you directly update a stack, you submit changes and AWS CloudFormation immediately deploys them. Use direct updates when you want to quickly deploy your updates. With change sets, you can preview the changes AWS CloudFormation will make to your stack, and then decide whether to apply those changes.
This is a known issue with cloudformation. Its frequently discussed on the forum https://forums.aws.amazon.com/message.jspa?messageID=718403#718403
You can create a stage resource separately (not within a deployment resource) and then reference the latest deployment
Stage:
Deployment: Ref Deployment1
Deployment1:
RefApiId: RestApi
then when you update the configuration you can add a new deployment. This will associate the latest changes with the stage.
Stage:
Deployment: Ref Deployment2
Deployment2:
RefApiId: RestApi
Note that you still need to use the DependsOn field to wire them up correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With