Skip to content

Order of tf-summarize output is not consistent #88

@armst297

Description

@armst297

When running tf-summarize on a json TF plan output, the resulting table does not always print in the same order, therefore making it more difficult to compare summaries.

Is there a way to force a consistent order? This makes it difficult to use for automating terraform deployments based on expected summarized changes.

E.g.) Running tf-summarize on the exact same plan json 3x in a row gives 2 different resulting tables (due to ordering)

$ cat terraform-plan-results.json | tf-summarize  
+----------+--------------------------------------------------------------------------------------------------------+
|  CHANGE  |                                                RESOURCE                                                |
+----------+--------------------------------------------------------------------------------------------------------+
| add      | module.client_infrastructure.module.ecs_task_definition_beatflower[0].aws_ecs_task_definition.ecs_task |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_service_beatflower[0].aws_ecs_service.ecs_service         |
+----------+--------------------------------------------------------------------------------------------------------+
| update   | module.client_infrastructure.module.ecs_task_service_web[0].aws_ecs_service.ecs_service                |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_service_worker[0].aws_ecs_service.ecs_service             |
+----------+--------------------------------------------------------------------------------------------------------+
| recreate | module.client_infrastructure.module.ecs_task_definition_web[0].aws_ecs_task_definition.ecs_task        |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_definition_worker[0].aws_ecs_task_definition.ecs_task     |
+----------+--------------------------------------------------------------------------------------------------------+
$ cat terraform-plan-results.json | tf-summarize  
+----------+--------------------------------------------------------------------------------------------------------+
|  CHANGE  |                                                RESOURCE                                                |
+----------+--------------------------------------------------------------------------------------------------------+
| update   | module.client_infrastructure.module.ecs_task_service_web[0].aws_ecs_service.ecs_service                |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_service_worker[0].aws_ecs_service.ecs_service             |
+----------+--------------------------------------------------------------------------------------------------------+
| recreate | module.client_infrastructure.module.ecs_task_definition_web[0].aws_ecs_task_definition.ecs_task        |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_definition_worker[0].aws_ecs_task_definition.ecs_task     |
+----------+--------------------------------------------------------------------------------------------------------+
| add      | module.client_infrastructure.module.ecs_task_definition_beatflower[0].aws_ecs_task_definition.ecs_task |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_service_beatflower[0].aws_ecs_service.ecs_service         |
+----------+--------------------------------------------------------------------------------------------------------+
$ cat terraform-plan-results.json | tf-summarize                      
+----------+--------------------------------------------------------------------------------------------------------+
|  CHANGE  |                                                RESOURCE                                                |
+----------+--------------------------------------------------------------------------------------------------------+
| add      | module.client_infrastructure.module.ecs_task_definition_beatflower[0].aws_ecs_task_definition.ecs_task |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_service_beatflower[0].aws_ecs_service.ecs_service         |
+----------+--------------------------------------------------------------------------------------------------------+
| update   | module.client_infrastructure.module.ecs_task_service_web[0].aws_ecs_service.ecs_service                |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_service_worker[0].aws_ecs_service.ecs_service             |
+----------+--------------------------------------------------------------------------------------------------------+
| recreate | module.client_infrastructure.module.ecs_task_definition_web[0].aws_ecs_task_definition.ecs_task        |
+          +--------------------------------------------------------------------------------------------------------+
|          | module.client_infrastructure.module.ecs_task_definition_worker[0].aws_ecs_task_definition.ecs_task     |
+----------+--------------------------------------------------------------------------------------------------------+

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions