I'm writing my first CF stacks and I'm running into failed deploys on the first try of course because I don't know the syntax and available parameters yet fully. I am validating my json and the template itself via the CLI but it can still run into issues at deployment and cause a rollback or failure. Now when it's a brand new stack and not an update, the deployment just fails and I can't update it, I have to completely destroy the stack and redeploy it brand new.
I was wondering how to go about this issue. Even tho the deleted stack is not in the console, the CLI will still list all of the stacks that have been created and destroyed previously and it's just not clean. I can't update the stack of course after fixing the issue that caused it to fail because it's in the failed state, I have to redeploy everything as if it was a completely new stack.
Any thoughts on this? How did you go about creating your first stacks?
Your first "create" of the stack needs to succeed, if it doesn't it must be deleted. Later updates can fail and be rolled back without having to delete the stack. I tend to delete in the console, but you can of course use "aws cloudformation delete-stack".
I don't bother to list stacks in the CLI, I just use the console, so I don't know what it displays. As soon as a stack is deleted you can create it again. You can detect that state with the command
The key for you could be to deploy a simple stack that you know will deploy, then add the complexity in later. You can do that by commenting out everything except one resource to deploy, which you can copy and paste from an AWS example. Visual Studio Code makes this easy with "Control - Shift - /" combination to comment / uncomment large blocks.
You should considering using YAML formatted CloudFormation, I find it much easier.