{"action":"created","issue":{"url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer/issues/66","repository_url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer","labels_url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer/issues/66/comments","events_url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer/issues/66/events","html_url":"https://github.com/softlayer/terraform-provider-softlayer/issues/66","id":195809088,"number":66,"title":"Should not try to parse empty strings","user":{"login":"athak","id":68638,"avatar_url":"https://avatars.githubusercontent.com/u/68638?v=3","gravatar_id":"","url":"https://api.github.com/users/athak","html_url":"https://github.com/athak","followers_url":"https://api.github.com/users/athak/followers","following_url":"https://api.github.com/users/athak/following{/other_user}","gists_url":"https://api.github.com/users/athak/gists{/gist_id}","starred_url":"https://api.github.com/users/athak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/athak/subscriptions","organizations_url":"https://api.github.com/users/athak/orgs","repos_url":"https://api.github.com/users/athak/repos","events_url":"https://api.github.com/users/athak/events{/privacy}","received_events_url":"https://api.github.com/users/athak/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-15T13:45:46Z","updated_at":"2016-12-15T19:03:43Z","closed_at":"2016-12-15T19:03:43Z","body":"We are trying to encapsulate some functionality in a custom module, trying to expose as many arguments from the underlying resources as possible through the module.  One of the resources used inside the module is softlayer_virtual_guest. So for example the module has these variables declared among others:\r\n```\r\nvariable \"image_id\" {\r\n  default     = \"\"\r\n}\r\n\r\nvariable \"private_vlan_id\" {\r\n  default     = \"\"\r\n}\r\n\r\nvariable \"public_vlan_id\" {\r\n  default     = \"\"\r\n}\r\n```\r\nAnd then passed to the resource:\r\n```\r\nresource \"softlayer_virtual_guest\" \"instance\" {\r\n  ...\r\n  image_id                 = \"${var.image_id}\"\r\n  ...\r\n  private_vlan_id          = \"${var.private_vlan_id}\"\r\n  public_vlan_id           = \"${var.public_vlan_id}\"\r\n  ...\r\n}\r\n```\r\nThe problem is that if no value is passed to the module, it still tries to interpret/parse the empty strings resulting in:\r\n```\r\nErrors:\r\n\r\n  * softlayer_virtual_guest.instance: cannot parse '' as int: strconv.ParseInt: parsing \"\": invalid syntax\r\n  * softlayer_virtual_guest.instance: cannot parse '' as int: strconv.ParseInt: parsing \"\": invalid syntax\r\n  * softlayer_virtual_guest.instance: \"image_id\": conflicts with os_reference_code (\"UBUNTU_14_64\")\r\n  * softlayer_virtual_guest.instance: \"os_reference_code\": conflicts with image_id (\"\")\r\n```\r\nThe first two are the public and private_vlan_id arguments. Commenting those in the resource makes the errors go away.\r\n\r\nGiven that these are optional arguments, empty strings should be interpreted as nil. This is with terraform 0.7.13 and latest provider release, 1.3.0.\r\n\r\nThanks for the awesome work!\r\n\r\nCheers,\r\nAtha"},"comment":{"url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer/issues/comments/267412013","html_url":"https://github.com/softlayer/terraform-provider-softlayer/issues/66#issuecomment-267412013","issue_url":"https://api.github.com/repos/softlayer/terraform-provider-softlayer/issues/66","id":267412013,"user":{"login":"renier","id":139994,"avatar_url":"https://avatars.githubusercontent.com/u/139994?v=3","gravatar_id":"","url":"https://api.github.com/users/renier","html_url":"https://github.com/renier","followers_url":"https://api.github.com/users/renier/followers","following_url":"https://api.github.com/users/renier/following{/other_user}","gists_url":"https://api.github.com/users/renier/gists{/gist_id}","starred_url":"https://api.github.com/users/renier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renier/subscriptions","organizations_url":"https://api.github.com/users/renier/orgs","repos_url":"https://api.github.com/users/renier/repos","events_url":"https://api.github.com/users/renier/events{/privacy}","received_events_url":"https://api.github.com/users/renier/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T19:03:43Z","updated_at":"2016-12-15T19:03:43Z","body":"@athak that is a problem in terraform when you mark a fields conflicting with each other. It looks up the values and that's how it deals with explicit empty strings when the type is TypeInt. You should look at creating a module that uses images and another that uses os reference codes."}}
{"actor":{"display_login":"renier"}}