{"action":"closed","issue":{"url":"https://api.github.com/repos/hashicorp/packer/issues/7167","repository_url":"https://api.github.com/repos/hashicorp/packer","labels_url":"https://api.github.com/repos/hashicorp/packer/issues/7167/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/packer/issues/7167/comments","events_url":"https://api.github.com/repos/hashicorp/packer/issues/7167/events","html_url":"https://github.com/hashicorp/packer/issues/7167","id":395950783,"node_id":"MDU6SXNzdWUzOTU5NTA3ODM=","number":7167,"title":"AWS EBS Builder throws Misleading error when there is no default VPC and vpc_id is set, but subnet_id is not.","user":{"login":"bgshacklett","id":583359,"node_id":"MDQ6VXNlcjU4MzM1OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/583359?v=4","gravatar_id":"","url":"https://api.github.com/users/bgshacklett","html_url":"https://github.com/bgshacklett","followers_url":"https://api.github.com/users/bgshacklett/followers","following_url":"https://api.github.com/users/bgshacklett/following{/other_user}","gists_url":"https://api.github.com/users/bgshacklett/gists{/gist_id}","starred_url":"https://api.github.com/users/bgshacklett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgshacklett/subscriptions","organizations_url":"https://api.github.com/users/bgshacklett/orgs","repos_url":"https://api.github.com/users/bgshacklett/repos","events_url":"https://api.github.com/users/bgshacklett/events{/privacy}","received_events_url":"https://api.github.com/users/bgshacklett/received_events","type":"User","site_admin":false},"labels":[{"id":126745464,"node_id":"MDU6TGFiZWwxMjY3NDU0NjQ=","url":"https://api.github.com/repos/hashicorp/packer/labels/builder/amazon","name":"builder/amazon","color":"d4c5f9","default":false},{"id":33051540,"node_id":"MDU6TGFiZWwzMzA1MTU0MA==","url":"https://api.github.com/repos/hashicorp/packer/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":45995766,"node_id":"MDU6TGFiZWw0NTk5NTc2Ng==","url":"https://api.github.com/repos/hashicorp/packer/labels/good%20first%20issue","name":"good first issue","color":"bfe5bf","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2019-01-04T14:48:13Z","updated_at":"2019-11-18T21:50:13Z","closed_at":"2019-11-18T21:50:12Z","author_association":"NONE","body":"- Packer version from `packer version`:  v1.3.3\r\n- Host platform : Windows 10 Version 1709\r\n- Debug log output from `PACKER_LOG=1 packer build template.json`.: https://gist.github.com/bgshacklett/4253650df0e405191a29d3804b52634c\r\n- The _simplest example template and scripts_ needed to reproduce the bug. https://gist.github.com/bgshacklett/1b8c5b0228c2ebf83f6365b6bf869048\r\n  \r\n# Summary\r\nIf the `vpc_id` argument is set and the `subnet_id` argument is unset when running against an AWS account with no default VPC, a `VPCIdNotSpecified` error will be received. This is misleading as the VPC ID has been specified by the user.\r\n\r\n# Steps to Reproduce:\r\n1. Ensure that the AWS account used for testing does _not_ have a Default VPC.\r\n2. Run `packer build` against the configuration provided above.\r\n\r\n## Expected Behavior\r\n* An error should be received indicating that the `subnet_id` argument is required.\r\n\r\n## Actual Behavior\r\n* The error `VPCIdNotSpecified` is received, indicating that the VPC ID has not been set.\r\n\r\n# Potential Solutions\r\n* Remove the `vpc_id` argument from the builder.  \r\n\r\n   **Reasoning:** The `vpc_id` argument requires that the `subnet_id` argument be set. As of #4879, when the `subnet_id` argument is set, the builder will automatically search AWS for the parent VPC, making the `vpc_id` argument redundant in all cases.  \r\n\r\n   **Potential Downsides:** \r\n   * The `vpc_id` argument may currently be used as a safety mechanism to ensure that Packer will always run in a given VPC, even if an erroneous subnet ID is passed in.\r\n* Validate that the `subnet_id` argument has a valid value when the `vpc_id` argument is set.  \r\n\r\n   **Reasoning:** Per the documentation, the `subnet_id` argument is required if the `vpc_id` argument is set. It is reasonable to expect this to be enforced in code.  \r\n\r\n   **Potential Downsides:**\r\n   * Work required to implement the change\r\n   * More code means more potential for bugs.\r\n\r\n* Perform further error handling when a `VPCIdNotSpecified` error is received (e.g.: check for the existence of a `subnet_id` argument and [re-]throw the appropriate error).\r\n   **Reasoning:** The `VPCIdNotSpecified` result from the API is ambiguous. Packer has enough information, at this point, to throw a more specific error.\r\n\r\n   **Potential Downsides:**\r\n   * Work required to implement the change\r\n   * More code means more potential for bugs; potential for errors to be squashed."}}
{"actor":{"display_login":"nywilken"}}