{"action":"created","issue":{"url":"https://api.github.com/repos/cloudtools/troposphere/issues/281","labels_url":"https://api.github.com/repos/cloudtools/troposphere/issues/281/labels{/name}","comments_url":"https://api.github.com/repos/cloudtools/troposphere/issues/281/comments","events_url":"https://api.github.com/repos/cloudtools/troposphere/issues/281/events","html_url":"https://github.com/cloudtools/troposphere/issues/281","id":91112087,"number":281,"title":"Unable to pass Cluster name as String","user":{"login":"bpholt","id":1455476,"avatar_url":"https://avatars.githubusercontent.com/u/1455476?v=3","gravatar_id":"","url":"https://api.github.com/users/bpholt","html_url":"https://github.com/bpholt","followers_url":"https://api.github.com/users/bpholt/followers","following_url":"https://api.github.com/users/bpholt/following{/other_user}","gists_url":"https://api.github.com/users/bpholt/gists{/gist_id}","starred_url":"https://api.github.com/users/bpholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpholt/subscriptions","organizations_url":"https://api.github.com/users/bpholt/orgs","repos_url":"https://api.github.com/users/bpholt/repos","events_url":"https://api.github.com/users/bpholt/events{/privacy}","received_events_url":"https://api.github.com/users/bpholt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-26T00:29:23Z","updated_at":"2015-07-02T15:47:24Z","closed_at":null,"body":"When using the ECS `Service` class, I'm unable to pass a simple string name to the `Cluster` property. For example:\r\n\r\n    service = Service('Service',\r\n                      Cluster='cluster',\r\n                      DesiredCount=2,\r\n                      LoadBalancers=[ecs_load_balancer],\r\n                      Role='ecsServiceRole',\r\n                      TaskDefinition=Ref(task_definition))\r\n\r\nIf I do so, I get a type error:\r\n\r\n    TypeError: Cluster is <type 'str'>, expected [<type 'basestring'>, <class 'troposphere.Ref'>]\r\n\r\nI don't understand why `'Cluster': ([basestring, Ref], False)` is the right type definition for the property ([`ecs.py:23`](https://github.com/cloudtools/troposphere/blob/78e7a075d461d706661fb5a8156df9a5b9ae7da4/troposphere/ecs.py#L23)). It appears that when passed a `Ref`, the type checking is simply ignored (see [`__init__.py:93`](https://github.com/cloudtools/troposphere/blob/78e7a075d461d706661fb5a8156df9a5b9ae7da4/troposphere/__init__.py#L93)), so it works in that case. If a string is passed, then it carries on to [`__init__.py:102-105`](https://github.com/cloudtools/troposphere/blob/78e7a075d461d706661fb5a8156df9a5b9ae7da4/troposphere/__init__.py#L102-L105), where it expects the passed value to be a list. Since it’s not, it raises a `TypeError`.\r\n\r\nI noticed there are several other places where the `([basestring, Ref], False)` syntax is used both in ECS and elsewhere, and I’m new to Python, so I’m probably missing something obvious. \r\n\r\nWe have separate CloudFormation templates for our clusters and the services running on the clusters, so in the service template I’m not sure how I can obtain something `Ref`erenceable to avoid passing the plain string."},"comment":{"url":"https://api.github.com/repos/cloudtools/troposphere/issues/comments/118074498","html_url":"https://github.com/cloudtools/troposphere/issues/281#issuecomment-118074498","issue_url":"https://api.github.com/repos/cloudtools/troposphere/issues/281","id":118074498,"user":{"login":"bpholt","id":1455476,"avatar_url":"https://avatars.githubusercontent.com/u/1455476?v=3","gravatar_id":"","url":"https://api.github.com/users/bpholt","html_url":"https://github.com/bpholt","followers_url":"https://api.github.com/users/bpholt/followers","following_url":"https://api.github.com/users/bpholt/following{/other_user}","gists_url":"https://api.github.com/users/bpholt/gists{/gist_id}","starred_url":"https://api.github.com/users/bpholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpholt/subscriptions","organizations_url":"https://api.github.com/users/bpholt/orgs","repos_url":"https://api.github.com/users/bpholt/repos","events_url":"https://api.github.com/users/bpholt/events{/privacy}","received_events_url":"https://api.github.com/users/bpholt/received_events","type":"User","site_admin":false},"created_at":"2015-07-02T15:47:24Z","updated_at":"2015-07-02T15:47:24Z","body":"They use a `Ref` when the cluster is declared elsewhere in the same template. In this case, the cluster is defined in a different template altogether and so a `Ref` is invalid.\r\n\r\nI’m working around this right now by adding a `Parameter` to my stack with a single-item list of values and a matching default, and then using a `Ref` to the parameter, but that’s obviously a hack. :-)"}}