{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-external/issues/21","repository_url":"https://api.github.com/repos/terraform-providers/terraform-provider-external","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-external/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-external/issues/21/comments","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-external/issues/21/events","html_url":"https://github.com/terraform-providers/terraform-provider-external/issues/21","id":343722202,"node_id":"MDU6SXNzdWUzNDM3MjIyMDI=","number":21,"title":"data external does not allow me to run any linux command","user":{"login":"hashibot[bot]","id":35615658,"node_id":"MDM6Qm90MzU2MTU2NTg=","avatar_url":"https://avatars2.githubusercontent.com/in/8332?v=4","gravatar_id":"","url":"https://api.github.com/users/hashibot%5Bbot%5D","html_url":"https://github.com/apps/hashibot","followers_url":"https://api.github.com/users/hashibot%5Bbot%5D/followers","following_url":"https://api.github.com/users/hashibot%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/hashibot%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/hashibot%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashibot%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/hashibot%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/hashibot%5Bbot%5D/repos","events_url":"https://api.github.com/users/hashibot%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/hashibot%5Bbot%5D/received_events","type":"Bot","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-23T17:20:05Z","updated_at":"2018-10-17T23:19:51Z","closed_at":null,"author_association":"NONE","body":"_This issue was originally opened by @xfustero as hashicorp/terraform#18524. It was migrated here as a result of the [provider split](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/). The original body of the issue is below._\r\n\r\n<hr>\r\n\r\nHi there,\r\n\r\nI am using Terraform v0.11.7 and AWS as cloud provider. I am using an ec2 instance type m5 and I have a problem when using multiple EBS volumes. It seems the instance maps the devices NVMe randomly so I can not hardcode on TF user_data the nvm device name to a certain mountpoint.\r\n\r\nTo solve it I defined a data \"external\" in the **templates.tf** that runs script mapNVMdevices.sh. This scripts found each NVM we have (2) to which device /dev/xvdN is associated and set variables in template_file defining the nvme1n1 and the nvme2m1 device name associated (/dev/xvdX, /dev/xvdY) and their mount points.\r\n\r\nThese variables are used in **user_data.yml** to mount it correctly. \r\n\r\n**templates.tf**\r\n```\r\ndata \"external\" \"nvm_devices\" {\r\n  program = [\"bash\", \"${path.module}/mapNVMdevices.sh\"]\r\n}\r\n\r\ndata \"template_file\" \"user_data\" {\r\n  template = \"${file(\"${path.module}/user_data.yml\")}\"\r\n    device_nvme1n1 = \"${data.external.nvm_devices.result.device_nvme1n1}\"\r\n    device_nvme2n1 = \"${data.external.nvm_devices.result.device_nvme2n1}\"\r\n    mnt1           = \"${data.external.nvm_devices.result.mnt1}\"\r\n    mnt2           = \"${data.external.nvm_devices.result.mnt2}\"\r\n  }\r\n}\r\n```\r\n\r\n**user_data.yml**\r\n```\r\nmounts:\r\n  - [ ${device_nvme1n1}, ${mnt1}, \"ext4\", \"defaults\", \"0\", \"0\" ]\r\n  - [ ${device_nvme2n1}, ${mnt2}, \"ext4\", \"defaults\", \"0\", \"0\" ]\r\n```\r\n\r\nHowever a **terraform plan**  is complaining about command not found for commands that are on the instance I am provisioning. I can run the bash script in that instance with no problem:\r\n\r\n```\r\nError: Error refreshing state: 1 error(s) occurred:\r\n\r\n* module.central-ftp.data.external.nvm_devices: 1 error(s) occurred:\r\n\r\n* module.central-ftp.data.external.nvm_devices: data.external.nvm_devices: failed to execute \"bash\": ../mapNVMdevices.sh: line 27: ebsnvme-id: command not found\r\n.../mapNVMdevices.sh: line 28: ebsnvme-id: command not found\r\n../mapNVMdevices.sh: line 42: jq: command not found\r\n\r\n```\r\nebsnvme-id and jq are in the path and even writing absolute path in the bash script I get this error.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-external/issues/comments/430822387","html_url":"https://github.com/terraform-providers/terraform-provider-external/issues/21#issuecomment-430822387","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-external/issues/21","id":430822387,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDgyMjM4Nw==","user":{"login":"bobbydeveaux","id":5550105,"node_id":"MDQ6VXNlcjU1NTAxMDU=","avatar_url":"https://avatars2.githubusercontent.com/u/5550105?v=4","gravatar_id":"","url":"https://api.github.com/users/bobbydeveaux","html_url":"https://github.com/bobbydeveaux","followers_url":"https://api.github.com/users/bobbydeveaux/followers","following_url":"https://api.github.com/users/bobbydeveaux/following{/other_user}","gists_url":"https://api.github.com/users/bobbydeveaux/gists{/gist_id}","starred_url":"https://api.github.com/users/bobbydeveaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobbydeveaux/subscriptions","organizations_url":"https://api.github.com/users/bobbydeveaux/orgs","repos_url":"https://api.github.com/users/bobbydeveaux/repos","events_url":"https://api.github.com/users/bobbydeveaux/events{/privacy}","received_events_url":"https://api.github.com/users/bobbydeveaux/received_events","type":"User","site_admin":false},"created_at":"2018-10-17T23:19:51Z","updated_at":"2018-10-17T23:19:51Z","author_association":"NONE","body":"+1 for simple bash script saying jq: command not found\r\n"}}
{"actor":{"display_login":"bobbydeveaux"}}