{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/243","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/243/labels{/name}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/243/comments","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/243/events","html_url":"https://github.com/terraform-providers/terraform-provider-digitalocean/issues/243","id":449463908,"node_id":"MDU6SXNzdWU0NDk0NjM5MDg=","number":243,"title":"[FreeBSD] DigitalOcean SSH Keys Not Attached to New Droplets","user":{"login":"mkeen","id":38221,"node_id":"MDQ6VXNlcjM4MjIx","avatar_url":"https://avatars0.githubusercontent.com/u/38221?v=4","gravatar_id":"","url":"https://api.github.com/users/mkeen","html_url":"https://github.com/mkeen","followers_url":"https://api.github.com/users/mkeen/followers","following_url":"https://api.github.com/users/mkeen/following{/other_user}","gists_url":"https://api.github.com/users/mkeen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkeen/subscriptions","organizations_url":"https://api.github.com/users/mkeen/orgs","repos_url":"https://api.github.com/users/mkeen/repos","events_url":"https://api.github.com/users/mkeen/events{/privacy}","received_events_url":"https://api.github.com/users/mkeen/received_events","type":"User","site_admin":false},"labels":[{"id":1049485552,"node_id":"MDU6TGFiZWwxMDQ5NDg1NTUy","url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/labels/do-api","name":"do-api","color":"0080ff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2019-05-28T20:32:54Z","updated_at":"2019-06-14T16:45:17Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm unable to attach an SSH key to a new DO droplet using Terraform. I've done some digging and there does appear to be a discrepancy between DO API documentation, and their own console implementation. I am able to attach my key just fine from the DO console, but cannot do it at all through Terraform. See below details.\r\n\r\n### Terraform Version\r\n```[user@machine terraform]$ terraform -v\r\nTerraform v0.12.0\r\n+ provider.digitalocean v1.3.0\r\n+ provider.local v1.2.2\r\n+ provider.null v2.1.2\r\n+ provider.template v2.1.2\r\n```\r\n\r\n### Affected Resource(s)\r\n- digitalocean_droplet\r\n\r\nIf this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.\r\n\r\n### Terraform Configuration Files\r\n```hcl\r\nresource \"digitalocean_droplet\" \"salt_master\" {\r\n  private_networking = true\r\n  backups = true\r\n  region = \"${var.region}\"\r\n  image = \"${var.image}\"\r\n  name = \"${var.name}\"\r\n  size = \"${var.size}\"\r\n  ssh_keys = [\"24688717\"]\r\n  ipv6 = false\r\n  \r\n  connection {\r\n    host = \"${self.ipv4_address}\"\r\n    user = \"root\"\r\n    type = \"ssh\"\r\n    private_key = \"${file(\"/home/user/.ssh/id_rsa\")}\"\r\n    timeout = \"5m\"\r\n  }\r\n\r\n  provisioner \"remote-exec\" {\r\n    inline = [\r\n      \"env ASSUME_ALWAYS_YES=YES pkg install git\",\r\n      \"env ASSUME_ALWAYS_YES=YES pkg install devel/py-gitpython\"\r\n    ]\r\n    \r\n  }\r\n  \r\n}\r\n```\r\n\r\n### Debug Output\r\n```\r\n019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: ---[ REQUEST ]---------------------------------------\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: POST /v2/droplets HTTP/1.1\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: Host: api.digitalocean.com\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: User-Agent: Terraform/0.12.0-rc1 godo/1.10.0\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: Content-Length: 182\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: Accept: application/json\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: Content-Type: application/json\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: Accept-Encoding: gzip\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: {\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"name\": \"saltm\",\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"region\": \"nyc1\",\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"size\": \"512mb\",\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"image\": \"freebsd-12-x64-zfs\",\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"ssh_keys\": [\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:   24688717\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  ],\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"backups\": true,\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"ipv6\": false,\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"private_networking\": true,\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"monitoring\": false,\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:  \"tags\": []\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: }\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4:\r\n2019-05-28T16:26:10.465-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: -----------------------------------------------------\r\n2019-05-28T16:26:11.679-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: 2019/05/28 16:26:11 [DEBUG] DigitalOcean API Response Details:\r\n2019-05-28T16:26:11.679-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: ---[ RESPONSE ]--------------------------------------\r\n2019-05-28T16:26:11.679-0400 [DEBUG] plugin.terraform-provider-digitalocean_v1.3.0_x4: HTTP/2.0 202 Accepted\r\n```\r\n\r\n### Expected Behavior\r\nThe SSH Key specified should have been added to the new droplet, or the API should produce an error.\r\n\r\n### Actual Behavior\r\nThey SSH key is not added to the new droplet. It is successfully created, but I am unable to access the instance using SSH at any point.  \r\n  \r\nI looked into this further, and while the DO API docs specify that the `ssh_keys` attribute should be used, and should work with either ids or fingerprints in a list, the Digital Ocean Console itself sends a different attribute, ssh_key_ids. The request that it sends looks like this:\r\n\r\n```\r\n{\"droplet\":{\"name\":\"freebsd-s-4vcpu-8gb-ams3-01\",\"size_id\":110,\"region_id\":9,\"image_id\":47424258,\"ssh_key_ids\":[24688717],\"volumes\":[],\"tags\":[],\"fleet_uuid\":\"f2339fec-5311-467c-91db-442db1c5b946\",\"vpc_uuid\":null}}\r\n```\r\n\r\n### Steps to Reproduce\r\nPlease list the steps required to reproduce the issue, for example:\r\n1. `terraform apply`\r\n\r\n### References\r\n- GH-159 Seems to talk about this, but was closed due to possible misconfiguration.\r\n"},"comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/comments/502182899","html_url":"https://github.com/terraform-providers/terraform-provider-digitalocean/issues/243#issuecomment-502182899","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-digitalocean/issues/243","id":502182899,"node_id":"MDEyOklzc3VlQ29tbWVudDUwMjE4Mjg5OQ==","user":{"login":"mkeen","id":38221,"node_id":"MDQ6VXNlcjM4MjIx","avatar_url":"https://avatars0.githubusercontent.com/u/38221?v=4","gravatar_id":"","url":"https://api.github.com/users/mkeen","html_url":"https://github.com/mkeen","followers_url":"https://api.github.com/users/mkeen/followers","following_url":"https://api.github.com/users/mkeen/following{/other_user}","gists_url":"https://api.github.com/users/mkeen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkeen/subscriptions","organizations_url":"https://api.github.com/users/mkeen/orgs","repos_url":"https://api.github.com/users/mkeen/repos","events_url":"https://api.github.com/users/mkeen/events{/privacy}","received_events_url":"https://api.github.com/users/mkeen/received_events","type":"User","site_admin":false},"created_at":"2019-06-14T16:45:17Z","updated_at":"2019-06-14T16:45:17Z","author_association":"NONE","body":"@eddiezane @andrewsomething Any update? 👻"}}
{"actor":{"display_login":"mkeen"}}