{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/17430","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/17430/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/17430/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/17430/events","html_url":"https://github.com/hashicorp/terraform/issues/17430","id":300018864,"number":17430,"title":"Persisting additional metadata somewhere?","user":{"login":"tusharmath","id":194482,"avatar_url":"https://avatars2.githubusercontent.com/u/194482?v=4","gravatar_id":"","url":"https://api.github.com/users/tusharmath","html_url":"https://github.com/tusharmath","followers_url":"https://api.github.com/users/tusharmath/followers","following_url":"https://api.github.com/users/tusharmath/following{/other_user}","gists_url":"https://api.github.com/users/tusharmath/gists{/gist_id}","starred_url":"https://api.github.com/users/tusharmath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tusharmath/subscriptions","organizations_url":"https://api.github.com/users/tusharmath/orgs","repos_url":"https://api.github.com/users/tusharmath/repos","events_url":"https://api.github.com/users/tusharmath/events{/privacy}","received_events_url":"https://api.github.com/users/tusharmath/received_events","type":"User","site_admin":false},"labels":[{"id":85946959,"url":"https://api.github.com/repos/hashicorp/terraform/labels/enhancement","name":"enhancement","color":"d4c5f9","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-25T11:37:24Z","updated_at":"2018-02-27T05:34:28Z","closed_at":null,"author_association":"NONE","body":"First of all terraform has made my life awfully simple, thanks a ton for making this amazing tool!\r\n\r\nI am trying to implement `BLUE` `GREEN` deployments using terraform. I have two fleets — `blue` and `green` and I make a deployment on them alternatively while also scaling-in and scaling-out using terraform. Everything is perfect except that I need to remember which fleet was deployed last and make sure the new deployment happens on the other fleet. \r\n\r\nIs there a way to do using some logic or maybe by maintaining some external state?\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/368753083","html_url":"https://github.com/hashicorp/terraform/issues/17430#issuecomment-368753083","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/17430","id":368753083,"user":{"login":"apparentlymart","id":20180,"avatar_url":"https://avatars1.githubusercontent.com/u/20180?v=4","gravatar_id":"","url":"https://api.github.com/users/apparentlymart","html_url":"https://github.com/apparentlymart","followers_url":"https://api.github.com/users/apparentlymart/followers","following_url":"https://api.github.com/users/apparentlymart/following{/other_user}","gists_url":"https://api.github.com/users/apparentlymart/gists{/gist_id}","starred_url":"https://api.github.com/users/apparentlymart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparentlymart/subscriptions","organizations_url":"https://api.github.com/users/apparentlymart/orgs","repos_url":"https://api.github.com/users/apparentlymart/repos","events_url":"https://api.github.com/users/apparentlymart/events{/privacy}","received_events_url":"https://api.github.com/users/apparentlymart/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T05:34:28Z","updated_at":"2018-02-27T05:34:28Z","author_association":"CONTRIBUTOR","body":"A different pattern I've seen before (and used myself in a previous job) is to place the cluster config in a module and instantiate it multiple times:\r\n\r\n```hcl\r\nmodule \"cluster-20180219\" {\r\n  source = \"(cluster module address)\"\r\n  ami = \"ami-abc123\"\r\n  instances = 3\r\n}\r\n\r\nmodule \"cluster-20180219\" {\r\n  source = \"(cluster module address)\"\r\n  ami = \"ami-abc567\"\r\n  instances = 5\r\n}\r\n```\r\n\r\nThen each time you want to roll a change you add a second module block, apply to create the new cluster, verify the release, remove the old module, and roll again.\r\n\r\nAn advantage of this approach is that you can also switch to a new version of the module itself by changing the source on the new block. The roll process can be use both for AMI changes and for config changes, considering each module block as immutable once it is added, until it is removed.\r\n\r\nWith Terraform as it currently stands I would either just manually edit the configs like above (and indeed did exactly that, albeit for a config that changed only once every couple months or so) or wrap some automation to generate module configurations programmatically based on some external input... such automation could then in principle step through the create/verify/update steps by scripting Terraform runs, especially if there is some automatic way to check if the new cluster is working.\r\n\r\nMy initial reaction is that this is something that ought to be built _around_ Terraform rather than within Terraform itself, but I will think a little about what Terraform could do itself here to help with this, in principle. If you have some thoughts yourself I'd love to hear them!"}}
{"actor":{"display_login":"apparentlymart"}}