{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/2479","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/2479/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/2479/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/2479/events","html_url":"https://github.com/mitchellh/packer/issues/2479","id":96195555,"number":2479,"title":"File provisioner fails Packer build immediately if file to be uploaded is missing","user":{"login":"patrickdlee","id":589362,"avatar_url":"https://avatars.githubusercontent.com/u/589362?v=3","gravatar_id":"","url":"https://api.github.com/users/patrickdlee","html_url":"https://github.com/patrickdlee","followers_url":"https://api.github.com/users/patrickdlee/followers","following_url":"https://api.github.com/users/patrickdlee/following{/other_user}","gists_url":"https://api.github.com/users/patrickdlee/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickdlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickdlee/subscriptions","organizations_url":"https://api.github.com/users/patrickdlee/orgs","repos_url":"https://api.github.com/users/patrickdlee/repos","events_url":"https://api.github.com/users/patrickdlee/events{/privacy}","received_events_url":"https://api.github.com/users/patrickdlee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-21T00:17:40Z","updated_at":"2015-07-21T02:27:02Z","closed_at":null,"body":"This behavior is logical in most cases and should certainly be the default. However, we have a use case in which a shell provisioner generates a file which we then want to upload using a file provisioner. In order to get around the error, we use zero-byte placeholder files to fool Packer into thinking all the files to be uploaded are already there when the build starts. Then we generate the real files and upload them. Yes, it feels quite icky to do this.\r\n\r\nI propose an optional configuration option to indicate that the file will be generated and the Packer build command should not fail because it's missing...\r\n\r\n    {\r\n      \"type\": \"file\",\r\n      \"source\": \"generated.tar.gz\",\r\n      \"destination\": \"/tmp/generated.tar.gz\",\r\n      \"generated\": \"true\"\r\n    }\r\n\r\nUsing \"generated\" as the option name is just a suggestion. There are other choices that may be clearer."},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/123131315","html_url":"https://github.com/mitchellh/packer/issues/2479#issuecomment-123131315","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/2479","id":123131315,"user":{"login":"cbednarski","id":649798,"avatar_url":"https://avatars.githubusercontent.com/u/649798?v=3","gravatar_id":"","url":"https://api.github.com/users/cbednarski","html_url":"https://github.com/cbednarski","followers_url":"https://api.github.com/users/cbednarski/followers","following_url":"https://api.github.com/users/cbednarski/following{/other_user}","gists_url":"https://api.github.com/users/cbednarski/gists{/gist_id}","starred_url":"https://api.github.com/users/cbednarski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbednarski/subscriptions","organizations_url":"https://api.github.com/users/cbednarski/orgs","repos_url":"https://api.github.com/users/cbednarski/repos","events_url":"https://api.github.com/users/cbednarski/events{/privacy}","received_events_url":"https://api.github.com/users/cbednarski/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T02:27:02Z","updated_at":"2015-07-21T02:27:02Z","body":"Thanks for the suggestion! This is an interesting use case. I'd like to understand it a bit better.\r\n\r\nCan you explain why you need to create this file with the local shell provisioner? Why, for example, can it not be generated before packer runs? I imagine you could, for example, share config state through environment variables and use `make` to do the prep work before kicking off the packer build.\r\n\r\nI'm aware that there are some difficulties around getting things _out_ of the VM being built but this is the first time I've seen trouble going the other direction."}}