i have managed to construct two sql servers each with their own elastic pools
i then create a failover group
as i add databases to the first server and include it in the failover group then all is well
but when i try to delete the database it can not remove it from the secondary server as it was not created by terraform but my microsoft failover.
I understand the documentation makes mention of this and that i should ‘create the resource if i want terraform to manage it’ butwithout an example I dont really understand what it wants me to do.
Has anyone else done this and could they explain what they want me to do to manage databases in failover groups through terraform alone?
I wasnt overly happy with not really understanding how I got it to work - so I tinkered around a bit more and found the solution. (not sure how to mark answers as solved here neither).
I was bamboozled by the advice presented by Terraform on their help docs:
NOTE: The failover group will create a secondary database for each database listed in databases . If the secondary databases need to be managed through Terraform, they should be defined as resources and a dependency added to the failover group to ensure the secondary databases are created first.
I believe this is wrong, It should read:
NOTE: The failover group will create a secondary database for each database listed in databases . If the secondary databases need to be managed through Terraform, they should be defined as resources and a dependency added to the secondary databases to ensure the failover group is created first.
As Microsoft creats the secondary database automatically, it makes sense to define the secondary database in the script to rely on the failover group having been built first - and therefore create the secondary databases. Terraform will then see they are built and register them in the state file without Terraform actually being responsibile for directly building them.
Error: sql.ElasticPoolsClient#Delete: Failure sending request: StatusCode=400 – Original Error: Code=“ElasticPoolNotEmpty” Message=“The elastic pool is not empty.”