{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/165","repository_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/165/labels{/name}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/165/comments","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/165/events","html_url":"https://github.com/terraform-providers/terraform-provider-digitalocean/issues/165","id":381304561,"node_id":"MDU6SXNzdWUzODEzMDQ1NjE=","number":165,"title":"Droplet resource removes attached volumes","user":{"login":"justinbarrick","id":29671524,"node_id":"MDQ6VXNlcjI5NjcxNTI0","avatar_url":"https://avatars2.githubusercontent.com/u/29671524?v=4","gravatar_id":"","url":"https://api.github.com/users/justinbarrick","html_url":"https://github.com/justinbarrick","followers_url":"https://api.github.com/users/justinbarrick/followers","following_url":"https://api.github.com/users/justinbarrick/following{/other_user}","gists_url":"https://api.github.com/users/justinbarrick/gists{/gist_id}","starred_url":"https://api.github.com/users/justinbarrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinbarrick/subscriptions","organizations_url":"https://api.github.com/users/justinbarrick/orgs","repos_url":"https://api.github.com/users/justinbarrick/repos","events_url":"https://api.github.com/users/justinbarrick/events{/privacy}","received_events_url":"https://api.github.com/users/justinbarrick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-15T19:23:19Z","updated_at":"2018-11-15T23:11:21Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"If a droplet resource has volumes attached to it that are managed outside of Terraform (in my use-case, my droplet has volumes attached by the [csi-digitalocean](https://github.com/digitalocean/csi-digitalocean)), then terraform will remove the volumes on next apply:\r\n\r\n```\r\n11:18:18  == terraform-deploy => module.kubernetes.digitalocean_droplet.kubernetes_nodes[3]: Modifying... (ID: 119197558)\r\n11:18:18  == terraform-deploy =>   volume_ids.#:          \"2\" => \"1\"\r\n11:18:18  == terraform-deploy =>   volume_ids.1419980023: \"48b29148-e85c-11e8-a1d1-0a58ac14e059\" => \"\"\r\n11:18:18  == terraform-deploy =>   volume_ids.604109777:  \"7eb4efce-e838-11e8-a1d1-0a58ac14e059\" => \"7eb4efce-e838-11e8-a1d1-0a58ac14e059\"\r\n```\r\n\r\nIs there any workaround for this issue?\r\n"},"comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/comments/439224015","html_url":"https://github.com/terraform-providers/terraform-provider-digitalocean/issues/165#issuecomment-439224015","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/165","id":439224015,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTIyNDAxNQ==","user":{"login":"andrewsomething","id":46943,"node_id":"MDQ6VXNlcjQ2OTQz","avatar_url":"https://avatars0.githubusercontent.com/u/46943?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewsomething","html_url":"https://github.com/andrewsomething","followers_url":"https://api.github.com/users/andrewsomething/followers","following_url":"https://api.github.com/users/andrewsomething/following{/other_user}","gists_url":"https://api.github.com/users/andrewsomething/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsomething/subscriptions","organizations_url":"https://api.github.com/users/andrewsomething/orgs","repos_url":"https://api.github.com/users/andrewsomething/repos","events_url":"https://api.github.com/users/andrewsomething/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsomething/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T23:11:21Z","updated_at":"2018-11-15T23:11:21Z","author_association":"COLLABORATOR","body":"If they are being managed outside of Terraform, I think that setting `ignore_changes` for the `volume_ids` attribute is probably the best way to go.\r\n```\r\nresource \"digitalocean_droplet\" \"web\" {\r\n  image  = \"ubuntu-18-04-x64\"\r\n  name   = \"web-1\"\r\n  region = \"nyc2\"\r\n  size   = \"s-1vcpu-1gb\"\r\n\r\n  lifecycle {\r\n      ignore_changes = [\"volume_ids\"]\r\n  }\r\n}\r\n```\r\nSee: https://www.terraform.io/docs/configuration/resources.html#ignore_changes\r\n\r\nIf you also have volumes that you are managing directly w/ Terraform, you can still use the `digitalocean_volume_attachment` resource."}}
{"actor":{"display_login":"andrewsomething"}}