{"action":"created","issue":{"url":"https://api.github.com/repos/sparkleformation/sparkle_formation/issues/181","repository_url":"https://api.github.com/repos/sparkleformation/sparkle_formation","labels_url":"https://api.github.com/repos/sparkleformation/sparkle_formation/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/sparkleformation/sparkle_formation/issues/181/comments","events_url":"https://api.github.com/repos/sparkleformation/sparkle_formation/issues/181/events","html_url":"https://github.com/sparkleformation/sparkle_formation/issues/181","id":160841185,"number":181,"title":"How can I specify references in the `unique_string` function for Azure?","user":{"login":"russellseymour","id":791658,"avatar_url":"https://avatars.githubusercontent.com/u/791658?v=3","gravatar_id":"","url":"https://api.github.com/users/russellseymour","html_url":"https://github.com/russellseymour","followers_url":"https://api.github.com/users/russellseymour/followers","following_url":"https://api.github.com/users/russellseymour/following{/other_user}","gists_url":"https://api.github.com/users/russellseymour/gists{/gist_id}","starred_url":"https://api.github.com/users/russellseymour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russellseymour/subscriptions","organizations_url":"https://api.github.com/users/russellseymour/orgs","repos_url":"https://api.github.com/users/russellseymour/repos","events_url":"https://api.github.com/users/russellseymour/events{/privacy}","received_events_url":"https://api.github.com/users/russellseymour/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-17T08:52:35Z","updated_at":"2016-06-22T16:03:42Z","closed_at":"2016-06-22T16:03:42Z","body":"Azure provides a way to generate a unique string for the storage account.  Sparkle has provision for this in the function `unique_string!`.\r\n\r\nI need to be able to generate the following:\r\n\r\n```\r\n\"storageAccountName\": \"[uniqueString(subscription().subscriptionId, resourceGroup().id]\"\r\n```\r\n\r\nAs can be seen the references are specific to Azure and are not strings.  However when I specify them in  Sparkle like this:\r\n\r\n```\r\nset!(\"storage_account_name\", unique_string!(\"subscription().subscriptionId\", \"resourceGroup().id\"))\r\n```\r\n\r\nI end up with:\r\n\r\n```\r\n\"storageAccountName\": \"[uniqueString('subscription().subscriptionId', 'resourceGroup().id']\"\r\n```\r\n\r\nWhich now just attempt to generate a `unique_string` on the static strings rather than the values that these functions would return.\r\n\r\nHow can I specify these values to `unique_string` so that it parses the linting for Sparkle yet still give me the desired result in the ARM template?\r\n\r\nThanks, Russell"},"comment":{"url":"https://api.github.com/repos/sparkleformation/sparkle_formation/issues/comments/227792244","html_url":"https://github.com/sparkleformation/sparkle_formation/issues/181#issuecomment-227792244","issue_url":"https://api.github.com/repos/sparkleformation/sparkle_formation/issues/181","id":227792244,"user":{"login":"chrisroberts","id":266674,"avatar_url":"https://avatars.githubusercontent.com/u/266674?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisroberts","html_url":"https://github.com/chrisroberts","followers_url":"https://api.github.com/users/chrisroberts/followers","following_url":"https://api.github.com/users/chrisroberts/following{/other_user}","gists_url":"https://api.github.com/users/chrisroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisroberts/subscriptions","organizations_url":"https://api.github.com/users/chrisroberts/orgs","repos_url":"https://api.github.com/users/chrisroberts/repos","events_url":"https://api.github.com/users/chrisroberts/events{/privacy}","received_events_url":"https://api.github.com/users/chrisroberts/received_events","type":"User","site_admin":false},"created_at":"2016-06-22T16:03:42Z","updated_at":"2016-06-22T16:03:42Z","body":"Hi! You can get the desired results by using the helper methods as parameters and not providing strings. The example you gave above can be rewritten as:\r\n\r\n```ruby\r\n  storage_account_name unique_string!(subscription!.subscriptionId, resource_group!.id)\r\n```\r\n\r\nwhich will give you the desired result:\r\n\r\n```json\r\n\"storageAccountName\": \"[uniqueString(subscription().subscriptionId, resourceGroup().id)]\"\r\n```\r\n\r\nIf you still end up with any issues, please just re-open this issue or create a new one.\r\n\r\nCheers!"}}
{"actor":{"display_login":"chrisroberts"}}