I can deploy an EB environment via CloudFormation with AWS::ElasticBeanstalk::Environment and AWS::ElasticBeanstalk::ApplicationVersion in the same template
That's great but if the beanstalk app deployment fails CloudFormation doesn't fail- the stack/environment is usually created successfully. So CloudFormation deploys successfully, the Beanstalk app version deploy fails, Beanstalk rolls back to the previous version, and returns to a healthy state and the only way I know it failed is to view the console or doing something wonky like try to check the current app version after the deployment.
The nested stack AWS::ElasticBeanstalk::Environment creates however does seem to fail if the app version deployment fails, but I can find no way of linking the two which is very annoying.
I need to programmatically identify the nested stack AWS::ElasticBeanstalk::Environment creates so after CloudFormation finishes and can check the status of that nested stack to see if the Beanstalk deploy was actually successful
Edit
At least they are tagged with the environment name. I really don't love this but it seems to work, curious about better options though:
aws cloudformation describe-stacks --query 'Stacks[?Tags[?Key == `elasticbeanstalk:environment-name` && Value == `myenvname`]].{StackName: StackName}' --output text