{"action":"created","issue":{"url":"https://api.github.com/repos/ITV/domed-city/issues/14","repository_url":"https://api.github.com/repos/ITV/domed-city","labels_url":"https://api.github.com/repos/ITV/domed-city/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/ITV/domed-city/issues/14/comments","events_url":"https://api.github.com/repos/ITV/domed-city/issues/14/events","html_url":"https://github.com/ITV/domed-city/issues/14","id":146965454,"number":14,"title":"Support locking","user":{"login":"xiii","id":156764,"avatar_url":"https://avatars.githubusercontent.com/u/156764?v=3","gravatar_id":"","url":"https://api.github.com/users/xiii","html_url":"https://github.com/xiii","followers_url":"https://api.github.com/users/xiii/followers","following_url":"https://api.github.com/users/xiii/following{/other_user}","gists_url":"https://api.github.com/users/xiii/gists{/gist_id}","starred_url":"https://api.github.com/users/xiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiii/subscriptions","organizations_url":"https://api.github.com/users/xiii/orgs","repos_url":"https://api.github.com/users/xiii/repos","events_url":"https://api.github.com/users/xiii/events{/privacy}","received_events_url":"https://api.github.com/users/xiii/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-04-08T15:46:03Z","updated_at":"2016-08-01T06:25:54Z","closed_at":null,"body":"In the event of 2 users working in the same TF codebase, we modify the plan / apply methods with a a lock helper method that does:\r\n\r\n```\r\ndef lock_tf_run\r\n   raise(\"someone else is playing in that environment\") unless there_is_no_lock_from_any_user_in_the_s3_bucket(bucket => \"environment bucket\")\r\n   create_s3_object(filename => \"username.lock\",contents => \"$timestamp\", bucket => \"environment bucket\"\r\nend\r\n\r\ndef unlock_tf_run\r\n  delete_s3_object(filename => \"username.lock\", bucket => \"environment bucket\"\r\nend\r\n```\r\n\r\n```\r\ndef create_plan\r\n      command         = \"terraform plan -module-depth=1 -refresh=true -out=#{@plan_file} -var-file=params/env.tfvars\"\r\n      failure_message = 'something went wrong when creating the TF plan'\r\n      *lock_tf_run*\r\n      execute_command(command, failure_message)\r\n    end\r\n```\r\n\r\n```\r\ndef apply\r\n      command         = \"terraform apply #{@plan_file}\"\r\n      failure_message = 'something went wrong when applying the TF plan'\r\n      execute_command(command, failure_message)\r\n      *unlock_tf_run*\r\n    end\r\n```"},"comment":{"url":"https://api.github.com/repos/ITV/domed-city/issues/comments/236499002","html_url":"https://github.com/ITV/domed-city/issues/14#issuecomment-236499002","issue_url":"https://api.github.com/repos/ITV/domed-city/issues/14","id":236499002,"user":{"login":"madAndroid","id":1321437,"avatar_url":"https://avatars.githubusercontent.com/u/1321437?v=3","gravatar_id":"","url":"https://api.github.com/users/madAndroid","html_url":"https://github.com/madAndroid","followers_url":"https://api.github.com/users/madAndroid/followers","following_url":"https://api.github.com/users/madAndroid/following{/other_user}","gists_url":"https://api.github.com/users/madAndroid/gists{/gist_id}","starred_url":"https://api.github.com/users/madAndroid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madAndroid/subscriptions","organizations_url":"https://api.github.com/users/madAndroid/orgs","repos_url":"https://api.github.com/users/madAndroid/repos","events_url":"https://api.github.com/users/madAndroid/events{/privacy}","received_events_url":"https://api.github.com/users/madAndroid/received_events","type":"User","site_admin":false},"created_at":"2016-08-01T06:25:54Z","updated_at":"2016-08-01T06:25:54Z","body":"Locking support has been implemented in #25 - this is currently being tested in core and root TF config."}}
{"actor":{"display_login":"madAndroid"}}