binxio / cfn-mysql-user-provider

A CloudFormation custom provider for managing MySQL users
Apache License 2.0
22 stars 19 forks source link

Fail if Custom Resource can't connect to Database #13

Open bogdankatishev opened 2 years ago

bogdankatishev commented 2 years ago

This PR fixes this old "closed" issue: https://github.com/binxio/cfn-mysql-user-provider/issues/6 To avoid waiting/hanging for a hour till cloudformation stops the update/delete itself.

In cloudformation, you will get this output

2022-05-11 17:49:59 UTC+0200 MySQLUserTest  CREATE_FAILED Received response status [FAILED] from custom resource. Message returned: Failed to create user, "Error while connecting to MySQL 2003: Can't connect to MySQL server on '$db-endpoint:$db-port' (timed out) ...

This will then trigger a ROLLBACK_IN_PROGRESS and then ROLLBACK_COMPLETE, all under 1 minute.