{"action":"created","issue":{"url":"https://api.github.com/repos/zalando-stups/senza/issues/155","repository_url":"https://api.github.com/repos/zalando-stups/senza","labels_url":"https://api.github.com/repos/zalando-stups/senza/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/zalando-stups/senza/issues/155/comments","events_url":"https://api.github.com/repos/zalando-stups/senza/issues/155/events","html_url":"https://github.com/zalando-stups/senza/issues/155","id":120400835,"number":155,"title":"Region aware YAML files","user":{"login":"vetinari","id":53407,"avatar_url":"https://avatars.githubusercontent.com/u/53407?v=3","gravatar_id":"","url":"https://api.github.com/users/vetinari","html_url":"https://github.com/vetinari","followers_url":"https://api.github.com/users/vetinari/followers","following_url":"https://api.github.com/users/vetinari/following{/other_user}","gists_url":"https://api.github.com/users/vetinari/gists{/gist_id}","starred_url":"https://api.github.com/users/vetinari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vetinari/subscriptions","organizations_url":"https://api.github.com/users/vetinari/orgs","repos_url":"https://api.github.com/users/vetinari/repos","events_url":"https://api.github.com/users/vetinari/events{/privacy}","received_events_url":"https://api.github.com/users/vetinari/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zalando-stups/senza/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-04T13:23:03Z","updated_at":"2016-06-08T12:33:06Z","closed_at":null,"body":"Please make \r\n* the region as passed to senza via the --region option available as replacement option in the yaml file. There is no need for duplication options like `senza create --region some-where-1 myapp.yaml stackVersion $version some-where-1`\r\n* mappings which can be defined ourselves which can then be inserted in place, like \r\n\r\n```    MyApp:\r\n        - some-where-1:\r\n             DockerEnv:\r\n                 SOME_KEY: \"aws:kms:$for_some_where_1\"\r\n        - some-where-2:\r\n             DockerEnv:\r\n                 SOME_KEY: \"aws:kms:$for_some_where_2\"\r\n```\r\n\r\nand something like\r\n\r\n```      TaupageConfig:\r\n           environment: \r\n               {MyApp: {{REGION}: DockerEnv}\r\n```\r\n    "},"comment":{"url":"https://api.github.com/repos/zalando-stups/senza/issues/comments/224574869","html_url":"https://github.com/zalando-stups/senza/issues/155#issuecomment-224574869","issue_url":"https://api.github.com/repos/zalando-stups/senza/issues/155","id":224574869,"user":{"login":"kenden","id":480586,"avatar_url":"https://avatars.githubusercontent.com/u/480586?v=3","gravatar_id":"","url":"https://api.github.com/users/kenden","html_url":"https://github.com/kenden","followers_url":"https://api.github.com/users/kenden/followers","following_url":"https://api.github.com/users/kenden/following{/other_user}","gists_url":"https://api.github.com/users/kenden/gists{/gist_id}","starred_url":"https://api.github.com/users/kenden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kenden/subscriptions","organizations_url":"https://api.github.com/users/kenden/orgs","repos_url":"https://api.github.com/users/kenden/repos","events_url":"https://api.github.com/users/kenden/events{/privacy}","received_events_url":"https://api.github.com/users/kenden/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T12:33:06Z","updated_at":"2016-06-08T12:33:06Z","body":"It is possible to use `Ref: AWS::Region` to find the region is the template. \r\nex:\r\n```\r\nFn::FindInMap: [LoadBalancerSubnets, {\"Ref\": \"AWS::Region\"}, Subnets]\r\n```\r\n\r\nHowever, it can be less practical  to use this in the user data.\r\nIt would be nice to be able to access the param passed to `--region` when calling Senza. \r\nMaybe with `{{SenzaInfo.Region}}` ?\r\n\r\nExample for why it might be more difficult to access `Ref: AWS::Region` in the userdata:\r\n```\r\n  LaunchConfig:\r\n    Type: \"AWS::AutoScaling::LaunchConfiguration\"\r\n    Properties:\r\n      InstanceType: m4.xlarge\r\n      ImageId: ami-28fb711e\r\n      IamInstanceProfile: configLoader\r\n      InstanceMonitoring: true\r\n      AssociatePublicIpAddress: false\r\n      SecurityGroups:\r\n        - Ref: MySecGroup\r\n      UserData:\r\n        Fn::Base64:\r\n          | # '|' Joins multiple lines into one string but keep line breaks\r\n            #!/usr/bin/env bash\r\n\r\n            set -ve # verbose and exit if any errors\r\n\r\n            echo \"Ref: AWS::Region\"  # <------ this will just echo \"Ref: AWS::Region\"\r\n            # It would be nice to be able to access the param passed to --region when calling Senza.\r\n            # Maybe like this?\r\n            # echo \"{{SenzaInfo.Region}}\"\r\n            # ... do more things\r\n```\r\n\r\nAs a workaround, you can use this in the userdata:\r\n```\r\nREGION=$(ec2metadata --availability-zone | sed 's/.$//')```\r\n# ---> $REGION is now eu-west-1, us-east-1. eu-central-1....\r\n```\r\n"}}
{"actor":{"display_login":"kenden"}}