Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running terraform plan manually rebuilds entire cluster and removes database #680

Closed
Wouter-J opened this issue Sep 1, 2021 · 2 comments
Labels

Comments

@Wouter-J
Copy link

Wouter-J commented Sep 1, 2021

Last week I had to re-run my pipeline to refresh my SSL certificates; today I noticed that my entire cluster got deleted and re-created; instead of refreshed

In the digital ocean log this can be seen (I re-ran the pipeline to make sure that action was causing it)
9e7addbf-4e96-4fc9-a55a-6450eaef942c

My terraform plan output tells me this:

digitalocean_database_db.mbdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/MeerBouw]

digitalocean_database_user.hbuser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/hb]

digitalocean_database_user.mbuser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/mb]

digitalocean_database_user.olcuser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/olc]

digitalocean_database_user.salesuser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/salesUser]

digitalocean_database_user.huizeruser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/huizerUser]

digitalocean_database_user.loguser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/loggingUser]

digitalocean_database_firewall.firewall: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590-20200617192922960600000001]

digitalocean_database_db.salesdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/SALES005]

digitalocean_database_db.huizerdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/HuizerBouw]

digitalocean_database_user.ssuser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/ss]

digitalocean_database_db.olcdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/OLC]

digitalocean_database_db.ssdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/StoringService]

digitalocean_database_db.hbdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/HuizerBouwer]

digitalocean_database_user.sbuser: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/user/sb]

digitalocean_database_db.logdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/UserLogs]

digitalocean_database_db.sbdb: Refreshing state... [id=14618c25-6161-4c54-a15d-da4f81676590/database/Sandbox]

And the plan says:

image

Plan: 1 to add, 2 to change, 1 to destroy.

The 1 being destroyed / recreated are the secrets which seems logical;

Finally the apply confirms this; but the DO result is as the first screenshot.

Apply complete! Resources: 1 added, 2 changed, 1 destroyed.

Additionally I do realise I am using an older version of terraform (0.14.5) but never had issues with it and it worked like expected before.

Affected Resource(s)

  • digitalocean_database_cluster
  • digitalocean_database_db
  • digitalocean_database_user
  • digitalocean_loadbalancer
  • digitalocean_app

Expected Behavior

A refresh of the SSL certs

Actual Behavior

A refresh of the certs did happen; but also the entire cluster was removed and re-created as a side effect

@Wouter-J Wouter-J added the bug label Sep 1, 2021
@andrewsomething
Copy link
Member

@Wouter-J The screenshot you shared is of the project activity. A resource being removed from a project does not necessarily mean that is has been destroyed. Can you use the API to check the created at date for your database cluster? If you have doctl installed you can do that with:

doctl databases get <database cluster id> --format Created

I suspect what you are seeing is issue #585 which was fixed in v2.6.0 of the DigitalOcean provider via #586. Before that change, project assignments happened in bulk which caused unnecessary churn in the project activity history.

You can also run Terraform in debug mode to look at the actual API request made behind the scenes to confirm whether or not DELETE requests are being made:

TF_LOG=debug terraform apply 

@Wouter-J
Copy link
Author

Wouter-J commented Sep 2, 2021

I see, it does appear that I am seeing issue #585 I will update my version and consider this issue fixed. Thank you for your comment!

@Wouter-J Wouter-J closed this as completed Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants