{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/15180","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/15180/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/15180/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/15180/events","html_url":"https://github.com/hashicorp/terraform/issues/15180","id":234396800,"node_id":"MDU6SXNzdWUyMzQzOTY4MDA=","number":15180,"title":"Improving perception of changes when showing diff","user":{"login":"danielcompton","id":811954,"node_id":"MDQ6VXNlcjgxMTk1NA==","avatar_url":"https://avatars2.githubusercontent.com/u/811954?v=4","gravatar_id":"","url":"https://api.github.com/users/danielcompton","html_url":"https://github.com/danielcompton","followers_url":"https://api.github.com/users/danielcompton/followers","following_url":"https://api.github.com/users/danielcompton/following{/other_user}","gists_url":"https://api.github.com/users/danielcompton/gists{/gist_id}","starred_url":"https://api.github.com/users/danielcompton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielcompton/subscriptions","organizations_url":"https://api.github.com/users/danielcompton/orgs","repos_url":"https://api.github.com/users/danielcompton/repos","events_url":"https://api.github.com/users/danielcompton/events{/privacy}","received_events_url":"https://api.github.com/users/danielcompton/received_events","type":"User","site_admin":false},"labels":[{"id":587361671,"node_id":"MDU6TGFiZWw1ODczNjE2NzE=","url":"https://api.github.com/repos/hashicorp/terraform/labels/cli","name":"cli","color":"006b75","default":false},{"id":85946959,"node_id":"MDU6TGFiZWw4NTk0Njk1OQ==","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":4,"created_at":"2017-06-08T02:47:53Z","updated_at":"2018-06-27T16:04:25Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"When I make a change to a large list of values (for example), the plan that Terraform shows is not as helpful as it could be. Here is what I see:\r\n\r\n<img width=\"655\" alt=\"screenshot of terminal 8-06-17 3-16-32 pm\" src=\"https://user-images.githubusercontent.com/811954/26910840-7ba93d92-4c5d-11e7-998f-f3533d169ef0.png\">\r\n\r\nThere are three important pieces of information here, but only one is clear:\r\n\r\n1. The resource `google_project_services.project` is changing (this is clear from colouring)\r\n2. The number of services in the list is changing from 21 -> 20\r\n3. The service that is being removed is \"container.googleapis.com\"\r\n\r\nThere is so much going on in the output that it is hard to easily see the relevant information. I have thought of some possible ways the output could be improved:\r\n\r\n* Highlighting lines that are changing with their related change colour (green, yellow, red for add, change, destroy respectively)\r\n* Aligning all of the `=>` so it is easier to scan for changes\r\n* De-emphasising the hash (133405307) with a lighter colour as it's specific value is usually not very important (I think?)\r\n* Sorting attributes that are changing to the top\r\n* Removing unchanged attributes from the diff\r\n\r\nI haven't really considered how default and computed values would be handled here, but it seems highly relevant and important.\r\n\r\nSome mockups:\r\n\r\n**Highlighting changed lines and deemphasising hash**\r\n\r\n<img width=\"652\" alt=\"screenshot of terminal 8-06-17 3-17-41 pm\" src=\"https://user-images.githubusercontent.com/811954/26910871-ae8f5804-4c5d-11e7-9302-1c2f3d3aa658.png\">\r\n\r\n\r\n**Align =>**\r\n\r\n```\r\n~ google_project_services.project\r\n    services.#:          \"21\" => \"20\"\r\n    services.133405307:  \"storage-component.googleapis.com\"    => \"storage-component.googleapis.com\"\r\n    services.1560437671: \"iam.googleapis.com\"                  => \"iam.googleapis.com\"\r\n    services.1712537408: \"containerregistry.googleapis.com\"    => \"containerregistry.googleapis.com\"\r\n    services.2117420113: \"pubsub.googleapis.com\"               => \"pubsub.googleapis.com\"\r\n    services.238136042:  \"cloudapis.googleapis.com\"            => \"cloudapis.googleapis.com\"\r\n    services.2471815660: \"servicemanagement.googleapis.com\"    => \"servicemanagement.googleapis.com\"\r\n    services.2631575801: \"sqladmin.googleapis.com\"             => \"sqladmin.googleapis.com\"\r\n    services.2928564140: \"dns.googleapis.com\"                  => \"dns.googleapis.com\"\r\n    services.2966512281: \"deploymentmanager.googleapis.com\"    => \"deploymentmanager.googleapis.com\"\r\n    services.3010261123: \"replicapool.googleapis.com\"          => \"replicapool.googleapis.com\"\r\n    services.3075019877: \"replicapoolupdater.googleapis.com\"   => \"replicapoolupdater.googleapis.com\"\r\n    services.3077910291: \"resourceviews.googleapis.com\"        => \"resourceviews.googleapis.com\"\r\n    services.323125032:  \"cloudtrace.googleapis.com\"           => \"cloudtrace.googleapis.com\"\r\n    services.3237295688: \"monitoring.googleapis.com\"           => \"monitoring.googleapis.com\"\r\n    services.3355193353: \"logging.googleapis.com\"              => \"logging.googleapis.com\"\r\n    services.3445186629: \"sourcerepo.googleapis.com\"           => \"sourcerepo.googleapis.com\"\r\n    services.3644083179: \"cloudresourcemanager.googleapis.com\" => \"cloudresourcemanager.googleapis.com\"\r\n    services.3731214611: \"compute-component.googleapis.com\"    => \"compute-component.googleapis.com\"\r\n    services.3740470850: \"container.googleapis.com\"            => \"\"\r\n    services.3875785048: \"storage-api.googleapis.com\"          => \"storage-api.googleapis.com\"\r\n    services.77316126:   \"sql-component.googleapis.com\"        => \"sql-component.googleapis.com\"\r\n```\r\n\r\n**Sorting changed attributes to top**\r\n\r\n```\r\n~ google_project_services.project\r\n    services.#:          \"21\" => \"20\"\r\n    services.3740470850: \"container.googleapis.com\" => \"\"\r\n        \r\n    services.133405307:  \"storage-component.googleapis.com\" => \"storage-component.googleapis.com\"\r\n    services.1560437671: \"iam.googleapis.com\" => \"iam.googleapis.com\"\r\n    services.1712537408: \"containerregistry.googleapis.com\" => \"containerregistry.googleapis.com\"\r\n    services.2117420113: \"pubsub.googleapis.com\" => \"pubsub.googleapis.com\"\r\n    services.238136042:  \"cloudapis.googleapis.com\" => \"cloudapis.googleapis.com\"\r\n    services.2471815660: \"servicemanagement.googleapis.com\" => \"servicemanagement.googleapis.com\"\r\n    services.2631575801: \"sqladmin.googleapis.com\" => \"sqladmin.googleapis.com\"\r\n    services.2928564140: \"dns.googleapis.com\" => \"dns.googleapis.com\"\r\n    services.2966512281: \"deploymentmanager.googleapis.com\" => \"deploymentmanager.googleapis.com\"\r\n    services.3010261123: \"replicapool.googleapis.com\" => \"replicapool.googleapis.com\"\r\n    services.3075019877: \"replicapoolupdater.googleapis.com\" => \"replicapoolupdater.googleapis.com\"\r\n    services.3077910291: \"resourceviews.googleapis.com\" => \"resourceviews.googleapis.com\"\r\n    services.323125032:  \"cloudtrace.googleapis.com\" => \"cloudtrace.googleapis.com\"\r\n    services.3237295688: \"monitoring.googleapis.com\" => \"monitoring.googleapis.com\"\r\n    services.3355193353: \"logging.googleapis.com\" => \"logging.googleapis.com\"\r\n    services.3445186629: \"sourcerepo.googleapis.com\" => \"sourcerepo.googleapis.com\"\r\n    services.3644083179: \"cloudresourcemanager.googleapis.com\" => \"cloudresourcemanager.googleapis.com\"\r\n    services.3731214611: \"compute-component.googleapis.com\" => \"compute-component.googleapis.com\"\r\n    services.3875785048: \"storage-api.googleapis.com\" => \"storage-api.googleapis.com\"\r\n    services.77316126:   \"sql-component.googleapis.com\" => \"sql-component.googleapis.com\"\r\n```\r\n\r\n**Removing unchanged attributes**\r\n\r\n```\r\n~ google_project_services.project\r\n    services.#:          \"21\" => \"20\"\r\n    services.3740470850: \"container.googleapis.com\" => \"\"\r\n        \r\n    services[]:          \"20 values unchanged\"\r\n```\r\n\r\nRelates partly to #15179.\r\n  "},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/400731756","html_url":"https://github.com/hashicorp/terraform/issues/15180#issuecomment-400731756","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/15180","id":400731756,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDczMTc1Ng==","user":{"login":"mikeputnam","id":213371,"node_id":"MDQ6VXNlcjIxMzM3MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/213371?v=4","gravatar_id":"","url":"https://api.github.com/users/mikeputnam","html_url":"https://github.com/mikeputnam","followers_url":"https://api.github.com/users/mikeputnam/followers","following_url":"https://api.github.com/users/mikeputnam/following{/other_user}","gists_url":"https://api.github.com/users/mikeputnam/gists{/gist_id}","starred_url":"https://api.github.com/users/mikeputnam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikeputnam/subscriptions","organizations_url":"https://api.github.com/users/mikeputnam/orgs","repos_url":"https://api.github.com/users/mikeputnam/repos","events_url":"https://api.github.com/users/mikeputnam/events{/privacy}","received_events_url":"https://api.github.com/users/mikeputnam/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T16:04:25Z","updated_at":"2018-06-27T16:04:25Z","author_association":"NONE","body":"Until this issue is resolved, this small awk utterance works to only show changes.\r\n\r\n`$ terraform plan | awk -F\"\\\"\" '$4 != $2 { print $0 }'`\r\n\r\n- `-F` sets the field separator to be quotes.\r\n- `$4 != $2` compares the quoted values for inequality.\r\n- `{print $0}` only prints the line if it is caught by the inequality check.\r\n\r\nWould **not** be printed: `ingress.9999999999.description:        \"foo\" => \"foo\"`\r\n\r\n**Would** be printed: `ingress.9999999999.description:        \"foo\" => \"bar\"`\r\n\r\nChances are your host already has awk.   :)\r\n"}}
{"actor":{"display_login":"mikeputnam"}}