From 82b5cfad7e707ba06dde19d1716c1e8d99b6c7f9 Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Fri, 20 Jan 2023 09:31:11 +0100 Subject: [PATCH] Add more equivalence tests that are testing edge cases around the new structured renderer (#32538) * add test cases * run equivalence tests * delete old outputs * drift_relevant_attributes should ignore the number attribute * also add a test for data reads * test destroy only --- .../outputs/basic_collections/apply.json | 192 -- .../outputs/basic_collections/plan | 45 - .../outputs/basic_collections/plan.json | 235 -- .../outputs/basic_collections/state.json | 74 - .../basic_collections_empty/apply.json | 198 -- .../outputs/basic_collections_empty/plan | 48 - .../outputs/basic_collections_empty/plan.json | 292 -- .../basic_collections_empty/state.json | 54 - .../outputs/basic_collections_null/apply.json | 198 -- .../outputs/basic_collections_null/plan | 48 - .../outputs/basic_collections_null/plan.json | 271 -- .../outputs/basic_collections_null/state.json | 48 - .../basic_collections_update/apply.json | 198 -- .../outputs/basic_collections_update/plan | 49 - .../basic_collections_update/plan.json | 344 -- .../basic_collections_update/state.json | 74 - .../basic_json_string_update/apply.json | 80 + .../outputs/basic_json_string_update/plan | 38 + .../basic_json_string_update/plan.json | 111 + .../basic_json_string_update/state.json | 26 + .../basic_multiline_string_update/apply.json | 80 + .../basic_multiline_string_update/plan | 31 + .../basic_multiline_string_update/plan.json | 111 + .../basic_multiline_string_update/state.json | 26 + .../equivalence-tests/outputs/data_read/plan | 45 + .../outputs/data_read/plan.json | 327 ++ .../outputs/drift_refresh_only/apply.json | 21 + .../outputs/drift_refresh_only/plan | 25 + .../outputs/drift_refresh_only/plan.json | 91 + .../outputs/drift_refresh_only/state.json | 26 + .../drift_relevant_attributes/apply.json | 139 + .../outputs/drift_relevant_attributes/plan | 47 + .../drift_relevant_attributes/plan.json | 236 ++ .../drift_relevant_attributes/state.json | 46 + .../outputs/drift_simple/apply.json | 80 + .../outputs/drift_simple/plan | 22 + .../outputs/drift_simple/plan.json | 144 + .../outputs/drift_simple/state.json | 26 + .../fully_populated_complex/apply.json | 78 + .../outputs/fully_populated_complex/plan | 228 ++ .../outputs/fully_populated_complex/plan.json | 1544 +++++++++ .../fully_populated_complex/state.json | 653 ++++ .../apply.json | 121 + .../fully_populated_complex_destroy/plan | 229 ++ .../fully_populated_complex_destroy/plan.json | 1545 +++++++++ .../state.json | 3 + .../fully_populated_complex_update/apply.json | 80 + .../fully_populated_complex_update/plan | 131 + .../fully_populated_complex_update/plan.json | 2834 +++++++++++++++++ .../fully_populated_complex_update/state.json | 657 ++++ .../outputs/moved_simple/apply.json | 21 + .../outputs/moved_simple/plan | 18 + .../outputs/moved_simple/plan.json | 112 + .../outputs/moved_simple/state.json | 26 + .../outputs/moved_with_drift/apply.json | 148 + .../outputs/moved_with_drift/plan | 49 + .../outputs/moved_with_drift/plan.json | 239 ++ .../outputs/moved_with_drift/state.json | 46 + .../moved_with_refresh_only/apply.json | 21 + .../outputs/moved_with_refresh_only/plan | 18 + .../outputs/moved_with_refresh_only/plan.json | 92 + .../moved_with_refresh_only/state.json | 26 + .../outputs/moved_with_update/apply.json | 89 + .../outputs/moved_with_update/plan | 23 + .../outputs/moved_with_update/plan.json | 112 + .../outputs/moved_with_update/state.json | 26 + .../outputs/replace_within_list/apply.json | 118 + .../outputs/replace_within_list/plan | 27 + .../outputs/replace_within_list/plan.json | 181 ++ .../outputs/replace_within_list/state.json | 38 + .../outputs/replace_within_map/apply.json | 118 + .../outputs/replace_within_map/plan | 27 + .../outputs/replace_within_map/plan.json | 181 ++ .../outputs/replace_within_map/state.json | 38 + .../outputs/replace_within_object/apply.json | 118 + .../outputs/replace_within_object/plan | 24 + .../outputs/replace_within_object/plan.json | 124 + .../outputs/replace_within_object/state.json | 26 + .../outputs/replace_within_set/apply.json | 118 + .../outputs/replace_within_set/plan | 30 + .../outputs/replace_within_set/plan.json | 179 ++ .../outputs/replace_within_set/state.json | 38 + .../.terraform.lock.hcl | 22 + .../tests/basic_json_string_update/main.tf | 14 + .../tests/basic_json_string_update/spec.json | 5 + .../5a3fd9b3-e852-8956-8c0a-255d47eda645.json | 10 + .../terraform.tfstate | 30 + .../tests/basic_list/spec.json | 1 + .../tests/basic_list_empty/spec.json | 1 + .../tests/basic_list_null/spec.json | 1 + .../tests/basic_list_update/spec.json | 1 + .../tests/basic_map/spec.json | 1 + .../tests/basic_map_empty/spec.json | 1 + .../tests/basic_map_null/spec.json | 1 + .../tests/basic_map_update/spec.json | 1 + .../.terraform.lock.hcl | 22 + .../basic_multiline_string_update/main.tf | 14 + .../basic_multiline_string_update/spec.json | 5 + .../69fe5233-e77a-804f-0dac-115c949540bc.json | 10 + .../terraform.tfstate | 30 + .../tests/basic_set/spec.json | 1 + .../tests/basic_set_empty/spec.json | 1 + .../tests/basic_set_null/spec.json | 1 + .../tests/basic_set_update/spec.json | 1 + .../tests/data_read/create/main.tf | 32 + .../equivalence-tests/tests/data_read/main.tf | 39 + .../tests/data_read/spec.json | 27 + .../drift_refresh_only/.terraform.lock.hcl | 22 + .../tests/drift_refresh_only/main.tf | 14 + .../tests/drift_refresh_only/spec.json | 43 + .../cb79269e-dc39-1e68-0a9c-63cb392afda9.json | 10 + .../drift_refresh_only/terraform.tfstate | 30 + .../.terraform.lock.hcl | 22 + .../tests/drift_relevant_attributes/main.tf | 19 + .../tests/drift_relevant_attributes/spec.json | 5 + .../1b17b502-96c9-fcc3-3b09-2af1c3de6ad8.json | 10 + .../f6f74ca6-e8ef-e51f-522c-433b9ed5038f.json | 13 + .../terraform.tfstate | 53 + .../tests/drift_simple/.terraform.lock.hcl | 22 + .../tests/drift_simple/main.tf | 14 + .../tests/drift_simple/spec.json | 5 + .../f3c6ddc5-37d5-0170-64ff-518ad421385a.json | 10 + .../tests/drift_simple/terraform.tfstate | 30 + .../tests/fully_populated_complex/main.tf | 209 ++ .../tests/fully_populated_complex/spec.json | 6 + .../.terraform.lock.hcl | 22 + .../fully_populated_complex_destroy/main.tf | 206 ++ .../fully_populated_complex_destroy/spec.json | 42 + .../64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json | 445 +++ .../terraform.tfstate | 556 ++++ .../.terraform.lock.hcl | 22 + .../fully_populated_complex_update/main.tf | 206 ++ .../fully_populated_complex_update/spec.json | 5 + .../64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json | 445 +++ .../terraform.tfstate | 556 ++++ .../tests/local_provider_basic/spec.json | 1 + .../tests/local_provider_delete/spec.json | 1 + .../tests/local_provider_update/spec.json | 1 + .../tests/moved_simple/.terraform.lock.hcl | 22 + .../tests/moved_simple/main.tf | 20 + .../tests/moved_simple/spec.json | 5 + .../70c47571-66c3-b1dc-2474-47a74b9c7886.json | 10 + .../tests/moved_simple/terraform.tfstate | 30 + .../moved_with_drift/.terraform.lock.hcl | 22 + .../tests/moved_with_drift/main.tf | 23 + .../tests/moved_with_drift/spec.json | 5 + .../2ecc718c-8d04-5774-5c36-7d69bf77d34e.json | 10 + .../e450ef2f-b80f-0cce-8bdb-14d88f48649c.json | 10 + .../tests/moved_with_drift/terraform.tfstate | 53 + .../.terraform.lock.hcl | 22 + .../tests/moved_with_refresh_only/main.tf | 20 + .../tests/moved_with_refresh_only/spec.json | 43 + .../70c47571-66c3-b1dc-2474-47a74b9c7886.json | 10 + .../moved_with_refresh_only/terraform.tfstate | 30 + .../moved_with_update/.terraform.lock.hcl | 22 + .../tests/moved_with_update/main.tf | 19 + .../tests/moved_with_update/spec.json | 5 + .../7da63aeb-f908-a112-9886-f29a0b0bd4ad.json | 10 + .../tests/moved_with_update/terraform.tfstate | 30 + .../tests/multiple_block_types/spec.json | 1 + .../multiple_block_types_update/spec.json | 1 + .../tests/nested_list/spec.json | 1 + .../tests/nested_list_update/spec.json | 1 + .../tests/nested_map/spec.json | 1 + .../tests/nested_map_update/spec.json | 1 + .../tests/nested_objects/spec.json | 1 + .../tests/nested_objects_update/spec.json | 1 + .../tests/nested_set/spec.json | 1 + .../tests/nested_set_update/spec.json | 1 + .../tests/null_provider_basic/spec.json | 1 + .../tests/null_provider_delete/spec.json | 1 + .../replace_within_list/.terraform.lock.hcl | 22 + .../dynamic_resources.json | 20 + .../tests/replace_within_list/main.tf | 26 + .../tests/replace_within_list/spec.json | 6 + .../F40F2AB4-100C-4AE8-BFD0-BF332A158415.json | 32 + .../replace_within_list/terraform.tfstate | 36 + .../replace_within_map/.terraform.lock.hcl | 22 + .../replace_within_map/dynamic_resources.json | 20 + .../tests/replace_within_map/main.tf | 26 + .../tests/replace_within_map/spec.json | 6 + .../F40F2AB4-100C-4AE8-BFD0-BF332A158415.json | 32 + .../replace_within_map/terraform.tfstate | 36 + .../replace_within_object/.terraform.lock.hcl | 22 + .../dynamic_resources.json | 17 + .../tests/replace_within_object/main.tf | 18 + .../tests/replace_within_object/spec.json | 6 + .../F40F2AB4-100C-4AE8-BFD0-BF332A158415.json | 14 + .../replace_within_object/terraform.tfstate | 28 + .../replace_within_set/.terraform.lock.hcl | 22 + .../replace_within_set/dynamic_resources.json | 20 + .../tests/replace_within_set/main.tf | 26 + .../tests/replace_within_set/spec.json | 6 + .../F40F2AB4-100C-4AE8-BFD0-BF332A158415.json | 32 + .../replace_within_set/terraform.tfstate | 36 + .../tests/simple_object/spec.json | 1 + .../tests/simple_object_empty/spec.json | 1 + .../tests/simple_object_null/spec.json | 1 + .../tests/simple_object_replace/spec.json | 1 + .../tests/simple_object_update/spec.json | 1 + .../tests/variables_and_outputs/spec.json | 1 + 201 files changed, 16619 insertions(+), 2368 deletions(-) delete mode 100644 testing/equivalence-tests/outputs/basic_collections/apply.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections/plan delete mode 100644 testing/equivalence-tests/outputs/basic_collections/plan.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections/state.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_empty/apply.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_empty/plan delete mode 100644 testing/equivalence-tests/outputs/basic_collections_empty/plan.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_empty/state.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_null/apply.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_null/plan delete mode 100644 testing/equivalence-tests/outputs/basic_collections_null/plan.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_null/state.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_update/apply.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_update/plan delete mode 100644 testing/equivalence-tests/outputs/basic_collections_update/plan.json delete mode 100644 testing/equivalence-tests/outputs/basic_collections_update/state.json create mode 100644 testing/equivalence-tests/outputs/basic_json_string_update/apply.json create mode 100644 testing/equivalence-tests/outputs/basic_json_string_update/plan create mode 100644 testing/equivalence-tests/outputs/basic_json_string_update/plan.json create mode 100644 testing/equivalence-tests/outputs/basic_json_string_update/state.json create mode 100644 testing/equivalence-tests/outputs/basic_multiline_string_update/apply.json create mode 100644 testing/equivalence-tests/outputs/basic_multiline_string_update/plan create mode 100644 testing/equivalence-tests/outputs/basic_multiline_string_update/plan.json create mode 100644 testing/equivalence-tests/outputs/basic_multiline_string_update/state.json create mode 100644 testing/equivalence-tests/outputs/data_read/plan create mode 100644 testing/equivalence-tests/outputs/data_read/plan.json create mode 100644 testing/equivalence-tests/outputs/drift_refresh_only/apply.json create mode 100644 testing/equivalence-tests/outputs/drift_refresh_only/plan create mode 100644 testing/equivalence-tests/outputs/drift_refresh_only/plan.json create mode 100644 testing/equivalence-tests/outputs/drift_refresh_only/state.json create mode 100644 testing/equivalence-tests/outputs/drift_relevant_attributes/apply.json create mode 100644 testing/equivalence-tests/outputs/drift_relevant_attributes/plan create mode 100644 testing/equivalence-tests/outputs/drift_relevant_attributes/plan.json create mode 100644 testing/equivalence-tests/outputs/drift_relevant_attributes/state.json create mode 100644 testing/equivalence-tests/outputs/drift_simple/apply.json create mode 100644 testing/equivalence-tests/outputs/drift_simple/plan create mode 100644 testing/equivalence-tests/outputs/drift_simple/plan.json create mode 100644 testing/equivalence-tests/outputs/drift_simple/state.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex/apply.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex/plan create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex/plan.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex/state.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_destroy/apply.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_destroy/state.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_update/apply.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_update/plan create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_update/plan.json create mode 100644 testing/equivalence-tests/outputs/fully_populated_complex_update/state.json create mode 100644 testing/equivalence-tests/outputs/moved_simple/apply.json create mode 100644 testing/equivalence-tests/outputs/moved_simple/plan create mode 100644 testing/equivalence-tests/outputs/moved_simple/plan.json create mode 100644 testing/equivalence-tests/outputs/moved_simple/state.json create mode 100644 testing/equivalence-tests/outputs/moved_with_drift/apply.json create mode 100644 testing/equivalence-tests/outputs/moved_with_drift/plan create mode 100644 testing/equivalence-tests/outputs/moved_with_drift/plan.json create mode 100644 testing/equivalence-tests/outputs/moved_with_drift/state.json create mode 100644 testing/equivalence-tests/outputs/moved_with_refresh_only/apply.json create mode 100644 testing/equivalence-tests/outputs/moved_with_refresh_only/plan create mode 100644 testing/equivalence-tests/outputs/moved_with_refresh_only/plan.json create mode 100644 testing/equivalence-tests/outputs/moved_with_refresh_only/state.json create mode 100644 testing/equivalence-tests/outputs/moved_with_update/apply.json create mode 100644 testing/equivalence-tests/outputs/moved_with_update/plan create mode 100644 testing/equivalence-tests/outputs/moved_with_update/plan.json create mode 100644 testing/equivalence-tests/outputs/moved_with_update/state.json create mode 100644 testing/equivalence-tests/outputs/replace_within_list/apply.json create mode 100644 testing/equivalence-tests/outputs/replace_within_list/plan create mode 100644 testing/equivalence-tests/outputs/replace_within_list/plan.json create mode 100644 testing/equivalence-tests/outputs/replace_within_list/state.json create mode 100644 testing/equivalence-tests/outputs/replace_within_map/apply.json create mode 100644 testing/equivalence-tests/outputs/replace_within_map/plan create mode 100644 testing/equivalence-tests/outputs/replace_within_map/plan.json create mode 100644 testing/equivalence-tests/outputs/replace_within_map/state.json create mode 100644 testing/equivalence-tests/outputs/replace_within_object/apply.json create mode 100644 testing/equivalence-tests/outputs/replace_within_object/plan create mode 100644 testing/equivalence-tests/outputs/replace_within_object/plan.json create mode 100644 testing/equivalence-tests/outputs/replace_within_object/state.json create mode 100644 testing/equivalence-tests/outputs/replace_within_set/apply.json create mode 100644 testing/equivalence-tests/outputs/replace_within_set/plan create mode 100644 testing/equivalence-tests/outputs/replace_within_set/plan.json create mode 100644 testing/equivalence-tests/outputs/replace_within_set/state.json create mode 100644 testing/equivalence-tests/tests/basic_json_string_update/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/basic_json_string_update/main.tf create mode 100644 testing/equivalence-tests/tests/basic_json_string_update/spec.json create mode 100644 testing/equivalence-tests/tests/basic_json_string_update/terraform.resource/5a3fd9b3-e852-8956-8c0a-255d47eda645.json create mode 100644 testing/equivalence-tests/tests/basic_json_string_update/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/basic_multiline_string_update/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/basic_multiline_string_update/main.tf create mode 100644 testing/equivalence-tests/tests/basic_multiline_string_update/spec.json create mode 100644 testing/equivalence-tests/tests/basic_multiline_string_update/terraform.resource/69fe5233-e77a-804f-0dac-115c949540bc.json create mode 100644 testing/equivalence-tests/tests/basic_multiline_string_update/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/data_read/create/main.tf create mode 100644 testing/equivalence-tests/tests/data_read/main.tf create mode 100644 testing/equivalence-tests/tests/data_read/spec.json create mode 100644 testing/equivalence-tests/tests/drift_refresh_only/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/drift_refresh_only/main.tf create mode 100644 testing/equivalence-tests/tests/drift_refresh_only/spec.json create mode 100644 testing/equivalence-tests/tests/drift_refresh_only/terraform.resource/cb79269e-dc39-1e68-0a9c-63cb392afda9.json create mode 100644 testing/equivalence-tests/tests/drift_refresh_only/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/drift_relevant_attributes/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/drift_relevant_attributes/main.tf create mode 100644 testing/equivalence-tests/tests/drift_relevant_attributes/spec.json create mode 100644 testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/1b17b502-96c9-fcc3-3b09-2af1c3de6ad8.json create mode 100644 testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/f6f74ca6-e8ef-e51f-522c-433b9ed5038f.json create mode 100644 testing/equivalence-tests/tests/drift_relevant_attributes/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/drift_simple/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/drift_simple/main.tf create mode 100644 testing/equivalence-tests/tests/drift_simple/spec.json create mode 100644 testing/equivalence-tests/tests/drift_simple/terraform.resource/f3c6ddc5-37d5-0170-64ff-518ad421385a.json create mode 100644 testing/equivalence-tests/tests/drift_simple/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/fully_populated_complex/main.tf create mode 100644 testing/equivalence-tests/tests/fully_populated_complex/spec.json create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_destroy/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_destroy/main.tf create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_destroy/spec.json create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_update/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_update/main.tf create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_update/spec.json create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_update/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json create mode 100644 testing/equivalence-tests/tests/fully_populated_complex_update/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/moved_simple/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/moved_simple/main.tf create mode 100644 testing/equivalence-tests/tests/moved_simple/spec.json create mode 100644 testing/equivalence-tests/tests/moved_simple/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json create mode 100644 testing/equivalence-tests/tests/moved_simple/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/moved_with_drift/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/moved_with_drift/main.tf create mode 100644 testing/equivalence-tests/tests/moved_with_drift/spec.json create mode 100644 testing/equivalence-tests/tests/moved_with_drift/terraform.resource/2ecc718c-8d04-5774-5c36-7d69bf77d34e.json create mode 100644 testing/equivalence-tests/tests/moved_with_drift/terraform.resource/e450ef2f-b80f-0cce-8bdb-14d88f48649c.json create mode 100644 testing/equivalence-tests/tests/moved_with_drift/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/moved_with_refresh_only/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/moved_with_refresh_only/main.tf create mode 100644 testing/equivalence-tests/tests/moved_with_refresh_only/spec.json create mode 100644 testing/equivalence-tests/tests/moved_with_refresh_only/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json create mode 100644 testing/equivalence-tests/tests/moved_with_refresh_only/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/moved_with_update/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/moved_with_update/main.tf create mode 100644 testing/equivalence-tests/tests/moved_with_update/spec.json create mode 100644 testing/equivalence-tests/tests/moved_with_update/terraform.resource/7da63aeb-f908-a112-9886-f29a0b0bd4ad.json create mode 100644 testing/equivalence-tests/tests/moved_with_update/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/replace_within_list/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/replace_within_list/dynamic_resources.json create mode 100644 testing/equivalence-tests/tests/replace_within_list/main.tf create mode 100644 testing/equivalence-tests/tests/replace_within_list/spec.json create mode 100644 testing/equivalence-tests/tests/replace_within_list/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json create mode 100644 testing/equivalence-tests/tests/replace_within_list/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/replace_within_map/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/replace_within_map/dynamic_resources.json create mode 100644 testing/equivalence-tests/tests/replace_within_map/main.tf create mode 100644 testing/equivalence-tests/tests/replace_within_map/spec.json create mode 100644 testing/equivalence-tests/tests/replace_within_map/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json create mode 100644 testing/equivalence-tests/tests/replace_within_map/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/replace_within_object/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/replace_within_object/dynamic_resources.json create mode 100644 testing/equivalence-tests/tests/replace_within_object/main.tf create mode 100644 testing/equivalence-tests/tests/replace_within_object/spec.json create mode 100644 testing/equivalence-tests/tests/replace_within_object/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json create mode 100644 testing/equivalence-tests/tests/replace_within_object/terraform.tfstate create mode 100644 testing/equivalence-tests/tests/replace_within_set/.terraform.lock.hcl create mode 100644 testing/equivalence-tests/tests/replace_within_set/dynamic_resources.json create mode 100644 testing/equivalence-tests/tests/replace_within_set/main.tf create mode 100644 testing/equivalence-tests/tests/replace_within_set/spec.json create mode 100644 testing/equivalence-tests/tests/replace_within_set/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json create mode 100644 testing/equivalence-tests/tests/replace_within_set/terraform.tfstate diff --git a/testing/equivalence-tests/outputs/basic_collections/apply.json b/testing/equivalence-tests/outputs/basic_collections/apply.json deleted file mode 100644 index 5874c55471c0..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections/apply.json +++ /dev/null @@ -1,192 +0,0 @@ -[ - { - "@level": "info", - "@message": "tfcoremock_map.map: Plan to create", - "@module": "terraform.ui", - "change": { - "action": "create", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Plan to create", - "@module": "terraform.ui", - "change": { - "action": "create", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Plan to create", - "@module": "terraform.ui", - "change": { - "action": "create", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Creating...", - "@module": "terraform.ui", - "hook": { - "action": "create", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Creating...", - "@module": "terraform.ui", - "hook": { - "action": "create", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Creating...", - "@module": "terraform.ui", - "hook": { - "action": "create", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Creation complete after 0s [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "create", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Creation complete after 0s [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "create", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Creation complete after 0s [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "create", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "Apply complete! Resources: 3 added, 0 changed, 0 destroyed.", - "@module": "terraform.ui", - "changes": { - "add": 3, - "change": 0, - "operation": "apply", - "remove": 0 - }, - "type": "change_summary" - }, - { - "@level": "info", - "@message": "Outputs: 0", - "@module": "terraform.ui", - "outputs": {}, - "type": "outputs" - } -] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections/plan b/testing/equivalence-tests/outputs/basic_collections/plan deleted file mode 100644 index e73125248616..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections/plan +++ /dev/null @@ -1,45 +0,0 @@ - -Terraform used the selected providers to generate the following execution -plan. Resource actions are indicated with the following symbols: - + create - -Terraform will perform the following actions: - - # tfcoremock_list.list will be created - + resource "tfcoremock_list" "list" { - + id = "985820B3-ACF9-4F00-94AD-F81C5EA33663" - + list = [ - + "9C2BE420-042D-440A-96E9-75565341C994", - + "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - + "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - ] - } - - # tfcoremock_map.map will be created - + resource "tfcoremock_map" "map" { - + id = "50E1A46E-E64A-4C1F-881C-BA85A5440964" - + map = { - + "one" = "682672C7-0918-4448-8342-887BAE01062A" - + "two" = "212FFBF6-40FE-4862-B708-E6AA508E84E0" - + "zero" = "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - - # tfcoremock_set.set will be created - + resource "tfcoremock_set" "set" { - + id = "046952C9-B832-4106-82C0-C217F7C73E18" - + set = [ - + "41471135-E14C-4946-BFA4-2626C7E2A94A", - + "C04762B9-D07B-40FE-A92B-B72AD342658D", - + "D8F7EA80-9E25-4DD7-8D97-797D2080952B", - ] - } - -Plan: 3 to add, 0 to change, 0 to destroy. - -───────────────────────────────────────────────────────────────────────────── - -Saved the plan to: equivalence_test_plan - -To perform exactly these actions, run the following command to apply: - terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/basic_collections/plan.json b/testing/equivalence-tests/outputs/basic_collections/plan.json deleted file mode 100644 index aca8dde22822..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections/plan.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "configuration": { - "provider_config": { - "tfcoremock": { - "full_name": "registry.terraform.io/hashicorp/tfcoremock", - "name": "tfcoremock", - "version_constraint": "0.1.1" - } - }, - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "expressions": { - "id": { - "constant_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663" - }, - "list": { - "constant_value": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - } - }, - "mode": "managed", - "name": "list", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "expressions": { - "id": { - "constant_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964" - }, - "map": { - "constant_value": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - "mode": "managed", - "name": "map", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "expressions": { - "id": { - "constant_value": "046952C9-B832-4106-82C0-C217F7C73E18" - }, - "set": { - "constant_value": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - }, - "mode": "managed", - "name": "set", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_set" - } - ] - } - }, - "format_version": "1.1", - "planned_values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - }, - "resource_changes": [ - { - "address": "tfcoremock_list.list", - "change": { - "actions": [ - "create" - ], - "after": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - }, - "after_sensitive": { - "list": [ - false, - false, - false - ] - }, - "after_unknown": {}, - "before": null, - "before_sensitive": false - }, - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "change": { - "actions": [ - "create" - ], - "after": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - }, - "after_sensitive": { - "map": {} - }, - "after_unknown": {}, - "before": null, - "before_sensitive": false - }, - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "change": { - "actions": [ - "create" - ], - "after": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - }, - "after_sensitive": { - "set": [ - false, - false, - false - ] - }, - "after_unknown": {}, - "before": null, - "before_sensitive": false - }, - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_set" - } - ] -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections/state.json b/testing/equivalence-tests/outputs/basic_collections/state.json deleted file mode 100644 index 54ce02bb9627..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections/state.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - } -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_empty/apply.json b/testing/equivalence-tests/outputs/basic_collections_empty/apply.json deleted file mode 100644 index fd44e0e992ae..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_empty/apply.json +++ /dev/null @@ -1,198 +0,0 @@ -[ - { - "@level": "info", - "@message": "tfcoremock_set.set: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Modifying... [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Modifications complete after 0s [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Modifying... [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Modifications complete after 0s [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Modifying... [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Modifications complete after 0s [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "Apply complete! Resources: 0 added, 3 changed, 0 destroyed.", - "@module": "terraform.ui", - "changes": { - "add": 0, - "change": 3, - "operation": "apply", - "remove": 0 - }, - "type": "change_summary" - }, - { - "@level": "info", - "@message": "Outputs: 0", - "@module": "terraform.ui", - "outputs": {}, - "type": "outputs" - } -] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_empty/plan b/testing/equivalence-tests/outputs/basic_collections_empty/plan deleted file mode 100644 index a1d0165eed2b..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_empty/plan +++ /dev/null @@ -1,48 +0,0 @@ -tfcoremock_set.set: Refreshing state... [id=046952C9-B832-4106-82C0-C217F7C73E18] -tfcoremock_map.map: Refreshing state... [id=50E1A46E-E64A-4C1F-881C-BA85A5440964] -tfcoremock_list.list: Refreshing state... [id=985820B3-ACF9-4F00-94AD-F81C5EA33663] - -Terraform used the selected providers to generate the following execution -plan. Resource actions are indicated with the following symbols: - ~ update in-place - -Terraform will perform the following actions: - - # tfcoremock_list.list will be updated in-place - ~ resource "tfcoremock_list" "list" { - id = "985820B3-ACF9-4F00-94AD-F81C5EA33663" - ~ list = [ - - "9C2BE420-042D-440A-96E9-75565341C994", - - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - ] - } - - # tfcoremock_map.map will be updated in-place - ~ resource "tfcoremock_map" "map" { - id = "50E1A46E-E64A-4C1F-881C-BA85A5440964" - ~ map = { - - "one" = "682672C7-0918-4448-8342-887BAE01062A" -> null - - "two" = "212FFBF6-40FE-4862-B708-E6AA508E84E0" -> null - - "zero" = "6B044AF7-172B-495B-BE11-B9546C12C3BD" -> null - } - } - - # tfcoremock_set.set will be updated in-place - ~ resource "tfcoremock_set" "set" { - id = "046952C9-B832-4106-82C0-C217F7C73E18" - ~ set = [ - - "41471135-E14C-4946-BFA4-2626C7E2A94A", - - "C04762B9-D07B-40FE-A92B-B72AD342658D", - - "D8F7EA80-9E25-4DD7-8D97-797D2080952B", - ] - } - -Plan: 0 to add, 3 to change, 0 to destroy. - -───────────────────────────────────────────────────────────────────────────── - -Saved the plan to: equivalence_test_plan - -To perform exactly these actions, run the following command to apply: - terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/basic_collections_empty/plan.json b/testing/equivalence-tests/outputs/basic_collections_empty/plan.json deleted file mode 100644 index 88256b3ae920..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_empty/plan.json +++ /dev/null @@ -1,292 +0,0 @@ -{ - "configuration": { - "provider_config": { - "tfcoremock": { - "full_name": "registry.terraform.io/hashicorp/tfcoremock", - "name": "tfcoremock", - "version_constraint": "0.1.1" - } - }, - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "expressions": { - "id": { - "constant_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663" - }, - "list": { - "constant_value": [] - } - }, - "mode": "managed", - "name": "list", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "expressions": { - "id": { - "constant_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964" - }, - "map": { - "constant_value": {} - } - }, - "mode": "managed", - "name": "map", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "expressions": { - "id": { - "constant_value": "046952C9-B832-4106-82C0-C217F7C73E18" - }, - "set": { - "constant_value": [] - } - }, - "mode": "managed", - "name": "set", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_set" - } - ] - } - }, - "format_version": "1.1", - "planned_values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": {} - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [] - } - } - ] - } - }, - "prior_state": { - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - } - }, - "resource_changes": [ - { - "address": "tfcoremock_list.list", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [] - }, - "after_sensitive": { - "list": [] - }, - "after_unknown": {}, - "before": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - }, - "before_sensitive": { - "list": [ - false, - false, - false - ] - } - }, - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": {} - }, - "after_sensitive": { - "map": {} - }, - "after_unknown": {}, - "before": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - }, - "before_sensitive": { - "map": {} - } - }, - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [] - }, - "after_sensitive": { - "set": [] - }, - "after_unknown": {}, - "before": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - }, - "before_sensitive": { - "set": [ - false, - false, - false - ] - } - }, - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_set" - } - ] -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_empty/state.json b/testing/equivalence-tests/outputs/basic_collections_empty/state.json deleted file mode 100644 index 369c254aed94..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_empty/state.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": {} - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [] - } - } - ] - } - } -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_null/apply.json b/testing/equivalence-tests/outputs/basic_collections_null/apply.json deleted file mode 100644 index 224efdce233d..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_null/apply.json +++ /dev/null @@ -1,198 +0,0 @@ -[ - { - "@level": "info", - "@message": "tfcoremock_set.set: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Modifying... [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Modifications complete after 0s [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Modifying... [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Modifying... [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Modifications complete after 0s [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Modifications complete after 0s [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "Apply complete! Resources: 0 added, 3 changed, 0 destroyed.", - "@module": "terraform.ui", - "changes": { - "add": 0, - "change": 3, - "operation": "apply", - "remove": 0 - }, - "type": "change_summary" - }, - { - "@level": "info", - "@message": "Outputs: 0", - "@module": "terraform.ui", - "outputs": {}, - "type": "outputs" - } -] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_null/plan b/testing/equivalence-tests/outputs/basic_collections_null/plan deleted file mode 100644 index 0c55ca8b6850..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_null/plan +++ /dev/null @@ -1,48 +0,0 @@ -tfcoremock_set.set: Refreshing state... [id=046952C9-B832-4106-82C0-C217F7C73E18] -tfcoremock_map.map: Refreshing state... [id=50E1A46E-E64A-4C1F-881C-BA85A5440964] -tfcoremock_list.list: Refreshing state... [id=985820B3-ACF9-4F00-94AD-F81C5EA33663] - -Terraform used the selected providers to generate the following execution -plan. Resource actions are indicated with the following symbols: - ~ update in-place - -Terraform will perform the following actions: - - # tfcoremock_list.list will be updated in-place - ~ resource "tfcoremock_list" "list" { - id = "985820B3-ACF9-4F00-94AD-F81C5EA33663" - - list = [ - - "9C2BE420-042D-440A-96E9-75565341C994", - - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - ] -> null - } - - # tfcoremock_map.map will be updated in-place - ~ resource "tfcoremock_map" "map" { - id = "50E1A46E-E64A-4C1F-881C-BA85A5440964" - - map = { - - "one" = "682672C7-0918-4448-8342-887BAE01062A" - - "two" = "212FFBF6-40FE-4862-B708-E6AA508E84E0" - - "zero" = "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } -> null - } - - # tfcoremock_set.set will be updated in-place - ~ resource "tfcoremock_set" "set" { - id = "046952C9-B832-4106-82C0-C217F7C73E18" - - set = [ - - "41471135-E14C-4946-BFA4-2626C7E2A94A", - - "C04762B9-D07B-40FE-A92B-B72AD342658D", - - "D8F7EA80-9E25-4DD7-8D97-797D2080952B", - ] -> null - } - -Plan: 0 to add, 3 to change, 0 to destroy. - -───────────────────────────────────────────────────────────────────────────── - -Saved the plan to: equivalence_test_plan - -To perform exactly these actions, run the following command to apply: - terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/basic_collections_null/plan.json b/testing/equivalence-tests/outputs/basic_collections_null/plan.json deleted file mode 100644 index 7d159c19fb86..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_null/plan.json +++ /dev/null @@ -1,271 +0,0 @@ -{ - "configuration": { - "provider_config": { - "tfcoremock": { - "full_name": "registry.terraform.io/hashicorp/tfcoremock", - "name": "tfcoremock", - "version_constraint": "0.1.1" - } - }, - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "expressions": { - "id": { - "constant_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663" - } - }, - "mode": "managed", - "name": "list", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "expressions": { - "id": { - "constant_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964" - } - }, - "mode": "managed", - "name": "map", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "expressions": { - "id": { - "constant_value": "046952C9-B832-4106-82C0-C217F7C73E18" - } - }, - "mode": "managed", - "name": "set", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_set" - } - ] - } - }, - "format_version": "1.1", - "planned_values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": {}, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": null - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": {}, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": null - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": {}, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": null - } - } - ] - } - }, - "prior_state": { - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - } - }, - "resource_changes": [ - { - "address": "tfcoremock_list.list", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": null - }, - "after_sensitive": {}, - "after_unknown": {}, - "before": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - }, - "before_sensitive": { - "list": [ - false, - false, - false - ] - } - }, - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": null - }, - "after_sensitive": {}, - "after_unknown": {}, - "before": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - }, - "before_sensitive": { - "map": {} - } - }, - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": null - }, - "after_sensitive": {}, - "after_unknown": {}, - "before": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - }, - "before_sensitive": { - "set": [ - false, - false, - false - ] - } - }, - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_set" - } - ] -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_null/state.json b/testing/equivalence-tests/outputs/basic_collections_null/state.json deleted file mode 100644 index eeebf056d7c6..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_null/state.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": {}, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": null - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": {}, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": null - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": {}, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": null - } - } - ] - } - } -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_update/apply.json b/testing/equivalence-tests/outputs/basic_collections_update/apply.json deleted file mode 100644 index 8fdfadf2a82c..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_update/apply.json +++ /dev/null @@ -1,198 +0,0 @@ -[ - { - "@level": "info", - "@message": "tfcoremock_map.map: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Plan to update", - "@module": "terraform.ui", - "change": { - "action": "update", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "planned_change" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Modifying... [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Modifying... [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_map.map: Modifications complete after 0s [id=50E1A46E-E64A-4C1F-881C-BA85A5440964]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "resource": { - "addr": "tfcoremock_map.map", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_map.map", - "resource_key": null, - "resource_name": "map", - "resource_type": "tfcoremock_map" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Modifying... [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_start" - }, - { - "@level": "info", - "@message": "tfcoremock_set.set: Modifications complete after 0s [id=046952C9-B832-4106-82C0-C217F7C73E18]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "046952C9-B832-4106-82C0-C217F7C73E18", - "resource": { - "addr": "tfcoremock_set.set", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_set.set", - "resource_key": null, - "resource_name": "set", - "resource_type": "tfcoremock_set" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "tfcoremock_list.list: Modifications complete after 0s [id=985820B3-ACF9-4F00-94AD-F81C5EA33663]", - "@module": "terraform.ui", - "hook": { - "action": "update", - "elapsed_seconds": 0, - "id_key": "id", - "id_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "resource": { - "addr": "tfcoremock_list.list", - "implied_provider": "tfcoremock", - "module": "", - "resource": "tfcoremock_list.list", - "resource_key": null, - "resource_name": "list", - "resource_type": "tfcoremock_list" - } - }, - "type": "apply_complete" - }, - { - "@level": "info", - "@message": "Apply complete! Resources: 0 added, 3 changed, 0 destroyed.", - "@module": "terraform.ui", - "changes": { - "add": 0, - "change": 3, - "operation": "apply", - "remove": 0 - }, - "type": "change_summary" - }, - { - "@level": "info", - "@message": "Outputs: 0", - "@module": "terraform.ui", - "outputs": {}, - "type": "outputs" - } -] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_update/plan b/testing/equivalence-tests/outputs/basic_collections_update/plan deleted file mode 100644 index e4284aa9ac27..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_update/plan +++ /dev/null @@ -1,49 +0,0 @@ -tfcoremock_map.map: Refreshing state... [id=50E1A46E-E64A-4C1F-881C-BA85A5440964] -tfcoremock_list.list: Refreshing state... [id=985820B3-ACF9-4F00-94AD-F81C5EA33663] -tfcoremock_set.set: Refreshing state... [id=046952C9-B832-4106-82C0-C217F7C73E18] - -Terraform used the selected providers to generate the following execution -plan. Resource actions are indicated with the following symbols: - ~ update in-place - -Terraform will perform the following actions: - - # tfcoremock_list.list will be updated in-place - ~ resource "tfcoremock_list" "list" { - id = "985820B3-ACF9-4F00-94AD-F81C5EA33663" - ~ list = [ - "9C2BE420-042D-440A-96E9-75565341C994", - - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - + "9B9F3ADF-8AD4-4E8C-AFE4-7BC2413E9AC0", - ] - } - - # tfcoremock_map.map will be updated in-place - ~ resource "tfcoremock_map" "map" { - id = "50E1A46E-E64A-4C1F-881C-BA85A5440964" - ~ map = { - + "four" = "D820D482-7C2C-4EF3-8935-863168A193F9" - - "one" = "682672C7-0918-4448-8342-887BAE01062A" -> null - # (2 unchanged elements hidden) - } - } - - # tfcoremock_set.set will be updated in-place - ~ resource "tfcoremock_set" "set" { - id = "046952C9-B832-4106-82C0-C217F7C73E18" - ~ set = [ - + "1769B76E-12F0-4214-A864-E843EB23B64E", - - "C04762B9-D07B-40FE-A92B-B72AD342658D", - # (2 unchanged elements hidden) - ] - } - -Plan: 0 to add, 3 to change, 0 to destroy. - -───────────────────────────────────────────────────────────────────────────── - -Saved the plan to: equivalence_test_plan - -To perform exactly these actions, run the following command to apply: - terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/basic_collections_update/plan.json b/testing/equivalence-tests/outputs/basic_collections_update/plan.json deleted file mode 100644 index 4de4ba5e7287..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_update/plan.json +++ /dev/null @@ -1,344 +0,0 @@ -{ - "configuration": { - "provider_config": { - "tfcoremock": { - "full_name": "registry.terraform.io/hashicorp/tfcoremock", - "name": "tfcoremock", - "version_constraint": "0.1.1" - } - }, - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "expressions": { - "id": { - "constant_value": "985820B3-ACF9-4F00-94AD-F81C5EA33663" - }, - "list": { - "constant_value": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - "9B9F3ADF-8AD4-4E8C-AFE4-7BC2413E9AC0" - ] - } - }, - "mode": "managed", - "name": "list", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "expressions": { - "id": { - "constant_value": "50E1A46E-E64A-4C1F-881C-BA85A5440964" - }, - "map": { - "constant_value": { - "four": "D820D482-7C2C-4EF3-8935-863168A193F9", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - "mode": "managed", - "name": "map", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "expressions": { - "id": { - "constant_value": "046952C9-B832-4106-82C0-C217F7C73E18" - }, - "set": { - "constant_value": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B", - "1769B76E-12F0-4214-A864-E843EB23B64E" - ] - } - }, - "mode": "managed", - "name": "set", - "provider_config_key": "tfcoremock", - "schema_version": 0, - "type": "tfcoremock_set" - } - ] - } - }, - "format_version": "1.1", - "planned_values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - "9B9F3ADF-8AD4-4E8C-AFE4-7BC2413E9AC0" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "four": "D820D482-7C2C-4EF3-8935-863168A193F9", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "1769B76E-12F0-4214-A864-E843EB23B64E", - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - }, - "prior_state": { - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - } - }, - "resource_changes": [ - { - "address": "tfcoremock_list.list", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - "9B9F3ADF-8AD4-4E8C-AFE4-7BC2413E9AC0" - ] - }, - "after_sensitive": { - "list": [ - false, - false, - false - ] - }, - "after_unknown": {}, - "before": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "3EC6EB1F-E372-46C3-A069-00D6E82EC1E1", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6" - ] - }, - "before_sensitive": { - "list": [ - false, - false, - false - ] - } - }, - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_list" - }, - { - "address": "tfcoremock_map.map", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "four": "D820D482-7C2C-4EF3-8935-863168A193F9", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - }, - "after_sensitive": { - "map": {} - }, - "after_unknown": {}, - "before": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "one": "682672C7-0918-4448-8342-887BAE01062A", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - }, - "before_sensitive": { - "map": {} - } - }, - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_map" - }, - { - "address": "tfcoremock_set.set", - "change": { - "actions": [ - "update" - ], - "after": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "1769B76E-12F0-4214-A864-E843EB23B64E", - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - }, - "after_sensitive": { - "set": [ - false, - false, - false - ] - }, - "after_unknown": {}, - "before": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "C04762B9-D07B-40FE-A92B-B72AD342658D", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - }, - "before_sensitive": { - "set": [ - false, - false, - false - ] - } - }, - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "type": "tfcoremock_set" - } - ] -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_collections_update/state.json b/testing/equivalence-tests/outputs/basic_collections_update/state.json deleted file mode 100644 index fc99804b135d..000000000000 --- a/testing/equivalence-tests/outputs/basic_collections_update/state.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "format_version": "1.0", - "values": { - "root_module": { - "resources": [ - { - "address": "tfcoremock_list.list", - "mode": "managed", - "name": "list", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "list": [ - false, - false, - false - ] - }, - "type": "tfcoremock_list", - "values": { - "id": "985820B3-ACF9-4F00-94AD-F81C5EA33663", - "list": [ - "9C2BE420-042D-440A-96E9-75565341C994", - "D01290F6-2D3A-45FA-B006-DAA80F6D31F6", - "9B9F3ADF-8AD4-4E8C-AFE4-7BC2413E9AC0" - ] - } - }, - { - "address": "tfcoremock_map.map", - "mode": "managed", - "name": "map", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "map": {} - }, - "type": "tfcoremock_map", - "values": { - "id": "50E1A46E-E64A-4C1F-881C-BA85A5440964", - "map": { - "four": "D820D482-7C2C-4EF3-8935-863168A193F9", - "two": "212FFBF6-40FE-4862-B708-E6AA508E84E0", - "zero": "6B044AF7-172B-495B-BE11-B9546C12C3BD" - } - } - }, - { - "address": "tfcoremock_set.set", - "mode": "managed", - "name": "set", - "provider_name": "registry.terraform.io/hashicorp/tfcoremock", - "schema_version": 0, - "sensitive_values": { - "set": [ - false, - false, - false - ] - }, - "type": "tfcoremock_set", - "values": { - "id": "046952C9-B832-4106-82C0-C217F7C73E18", - "set": [ - "1769B76E-12F0-4214-A864-E843EB23B64E", - "41471135-E14C-4946-BFA4-2626C7E2A94A", - "D8F7EA80-9E25-4DD7-8D97-797D2080952B" - ] - } - } - ] - } - } -} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_json_string_update/apply.json b/testing/equivalence-tests/outputs/basic_json_string_update/apply.json new file mode 100644 index 000000000000..060b285be0d2 --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_json_string_update/apply.json @@ -0,0 +1,80 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_simple_resource.json: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_simple_resource.json", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.json", + "resource_key": null, + "resource_name": "json", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.json: Modifying... [id=5a3fd9b3-e852-8956-8c0a-255d47eda645]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "resource": { + "addr": "tfcoremock_simple_resource.json", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.json", + "resource_key": null, + "resource_name": "json", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.json: Modifications complete after 0s [id=5a3fd9b3-e852-8956-8c0a-255d47eda645]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "resource": { + "addr": "tfcoremock_simple_resource.json", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.json", + "resource_key": null, + "resource_name": "json", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 1 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 1, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_json_string_update/plan b/testing/equivalence-tests/outputs/basic_json_string_update/plan new file mode 100644 index 000000000000..bf68bbe83114 --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_json_string_update/plan @@ -0,0 +1,38 @@ +tfcoremock_simple_resource.json: Refreshing state... [id=5a3fd9b3-e852-8956-8c0a-255d47eda645] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.json will be updated in-place + ~ resource "tfcoremock_simple_resource" "json" { + id = "5a3fd9b3-e852-8956-8c0a-255d47eda645" + ~ string = jsonencode( + ~ { + ~ list-attribute = [ + "one", + - "two", + + "four", + "three", + ] + ~ object-attribute = { + + key_four = "value_three" + ~ key_three = "value_three" -> "value_two" + - key_two = "value_two" -> null + # (1 unchanged element hidden) + } + ~ string-attribute = "string" -> "a new string" + } + ) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/basic_json_string_update/plan.json b/testing/equivalence-tests/outputs/basic_json_string_update/plan.json new file mode 100644 index 000000000000..8b4ec55f182b --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_json_string_update/plan.json @@ -0,0 +1,111 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.json", + "expressions": { + "string": { + "constant_value": "{\"list-attribute\":[\"one\",\"four\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_three\":\"value_two\", \"key_four\":\"value_three\"},\"string-attribute\":\"a new string\"}" + } + }, + "mode": "managed", + "name": "json", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.json", + "mode": "managed", + "name": "json", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "integer": null, + "number": null, + "string": "{\"list-attribute\":[\"one\",\"four\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_three\":\"value_two\", \"key_four\":\"value_three\"},\"string-attribute\":\"a new string\"}" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.json", + "mode": "managed", + "name": "json", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "integer": null, + "number": null, + "string": "{\"list-attribute\":[\"one\",\"two\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_two\":\"value_two\",\"key_three\":\"value_three\"},\"string-attribute\":\"string\"}" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.json", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "integer": null, + "number": null, + "string": "{\"list-attribute\":[\"one\",\"four\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_three\":\"value_two\", \"key_four\":\"value_three\"},\"string-attribute\":\"a new string\"}" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "integer": null, + "number": null, + "string": "{\"list-attribute\":[\"one\",\"two\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_two\":\"value_two\",\"key_three\":\"value_three\"},\"string-attribute\":\"string\"}" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "json", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_json_string_update/state.json b/testing/equivalence-tests/outputs/basic_json_string_update/state.json new file mode 100644 index 000000000000..67820818ef61 --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_json_string_update/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.json", + "mode": "managed", + "name": "json", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "integer": null, + "number": null, + "string": "{\"list-attribute\":[\"one\",\"four\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_three\":\"value_two\", \"key_four\":\"value_three\"},\"string-attribute\":\"a new string\"}" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_multiline_string_update/apply.json b/testing/equivalence-tests/outputs/basic_multiline_string_update/apply.json new file mode 100644 index 000000000000..982df2c18e4c --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_multiline_string_update/apply.json @@ -0,0 +1,80 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_simple_resource.multiline: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_simple_resource.multiline", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.multiline", + "resource_key": null, + "resource_name": "multiline", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.multiline: Modifying... [id=69fe5233-e77a-804f-0dac-115c949540bc]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "69fe5233-e77a-804f-0dac-115c949540bc", + "resource": { + "addr": "tfcoremock_simple_resource.multiline", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.multiline", + "resource_key": null, + "resource_name": "multiline", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.multiline: Modifications complete after 0s [id=69fe5233-e77a-804f-0dac-115c949540bc]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "69fe5233-e77a-804f-0dac-115c949540bc", + "resource": { + "addr": "tfcoremock_simple_resource.multiline", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.multiline", + "resource_key": null, + "resource_name": "multiline", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 1 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 1, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_multiline_string_update/plan b/testing/equivalence-tests/outputs/basic_multiline_string_update/plan new file mode 100644 index 000000000000..665d430b209a --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_multiline_string_update/plan @@ -0,0 +1,31 @@ +tfcoremock_simple_resource.multiline: Refreshing state... [id=69fe5233-e77a-804f-0dac-115c949540bc] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.multiline will be updated in-place + ~ resource "tfcoremock_simple_resource" "multiline" { + id = "69fe5233-e77a-804f-0dac-115c949540bc" + ~ string = <<-EOT + one + - two + three + + two + four + - five + + six + + seven + EOT + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/basic_multiline_string_update/plan.json b/testing/equivalence-tests/outputs/basic_multiline_string_update/plan.json new file mode 100644 index 000000000000..3a3770e29bb9 --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_multiline_string_update/plan.json @@ -0,0 +1,111 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.multiline", + "expressions": { + "string": { + "constant_value": "one\nthree\ntwo\nfour\nsix\nseven" + } + }, + "mode": "managed", + "name": "multiline", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.multiline", + "mode": "managed", + "name": "multiline", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "69fe5233-e77a-804f-0dac-115c949540bc", + "integer": null, + "number": null, + "string": "one\nthree\ntwo\nfour\nsix\nseven" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.multiline", + "mode": "managed", + "name": "multiline", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "69fe5233-e77a-804f-0dac-115c949540bc", + "integer": null, + "number": null, + "string": "one\ntwo\nthree\nfour\nfive" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.multiline", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "69fe5233-e77a-804f-0dac-115c949540bc", + "integer": null, + "number": null, + "string": "one\nthree\ntwo\nfour\nsix\nseven" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "69fe5233-e77a-804f-0dac-115c949540bc", + "integer": null, + "number": null, + "string": "one\ntwo\nthree\nfour\nfive" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "multiline", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/basic_multiline_string_update/state.json b/testing/equivalence-tests/outputs/basic_multiline_string_update/state.json new file mode 100644 index 000000000000..1ee0ace0bc97 --- /dev/null +++ b/testing/equivalence-tests/outputs/basic_multiline_string_update/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.multiline", + "mode": "managed", + "name": "multiline", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "69fe5233-e77a-804f-0dac-115c949540bc", + "integer": null, + "number": null, + "string": "one\nthree\ntwo\nfour\nsix\nseven" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/data_read/plan b/testing/equivalence-tests/outputs/data_read/plan new file mode 100644 index 000000000000..db9bf34d2905 --- /dev/null +++ b/testing/equivalence-tests/outputs/data_read/plan @@ -0,0 +1,45 @@ + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + + create + <= read (data resources) + +Terraform will perform the following actions: + + # data.tfcoremock_simple_resource.read will be read during apply + # (config refers to values not yet known) + <= data "tfcoremock_simple_resource" "read" { + + id = (known after apply) + } + + # tfcoremock_simple_resource.create will be created + + resource "tfcoremock_simple_resource" "create" { + + id = (known after apply) + } + + # module.create.local_file.data_file will be created + + resource "local_file" "data_file" { + + content = (known after apply) + + directory_permission = "0777" + + file_permission = "0777" + + filename = (known after apply) + + id = (known after apply) + } + + # module.create.random_integer.random will be created + + resource "random_integer" "random" { + + id = (known after apply) + + max = 9.999999e+06 + + min = 1e+06 + + result = (known after apply) + + seed = "F78CB410-BA01-44E1-82E1-37D61F7CB158" + } + +Plan: 3 to add, 0 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/data_read/plan.json b/testing/equivalence-tests/outputs/data_read/plan.json new file mode 100644 index 000000000000..f93c8589f443 --- /dev/null +++ b/testing/equivalence-tests/outputs/data_read/plan.json @@ -0,0 +1,327 @@ +{ + "configuration": { + "provider_config": { + "local": { + "full_name": "registry.terraform.io/hashicorp/local", + "name": "local", + "version_constraint": "2.2.3" + }, + "random": { + "full_name": "registry.terraform.io/hashicorp/random", + "name": "random", + "version_constraint": "3.4.3" + }, + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "module_calls": { + "create": { + "expressions": { + "contents": { + "constant_value": "hello, world!" + } + }, + "module": { + "outputs": { + "id": { + "expression": { + "references": [ + "random_integer.random.id", + "random_integer.random" + ] + } + } + }, + "resources": [ + { + "address": "local_file.data_file", + "expressions": { + "content": { + "references": [ + "local.contents" + ] + }, + "filename": { + "references": [ + "random_integer.random.id", + "random_integer.random" + ] + } + }, + "mode": "managed", + "name": "data_file", + "provider_config_key": "local", + "schema_version": 0, + "type": "local_file" + }, + { + "address": "random_integer.random", + "expressions": { + "max": { + "constant_value": 9999999 + }, + "min": { + "constant_value": 1000000 + }, + "seed": { + "constant_value": "F78CB410-BA01-44E1-82E1-37D61F7CB158" + } + }, + "mode": "managed", + "name": "random", + "provider_config_key": "random", + "schema_version": 0, + "type": "random_integer" + } + ], + "variables": { + "contents": {} + } + }, + "source": "./create" + } + }, + "resources": [ + { + "address": "tfcoremock_simple_resource.create", + "expressions": { + "string": { + "references": [ + "data.tfcoremock_simple_resource.read.string", + "data.tfcoremock_simple_resource.read" + ] + } + }, + "mode": "managed", + "name": "create", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + }, + { + "address": "data.tfcoremock_simple_resource.read", + "depends_on": [ + "module.create" + ], + "expressions": { + "id": { + "references": [ + "module.create.id", + "module.create" + ] + } + }, + "mode": "data", + "name": "read", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "child_modules": [ + { + "address": "module.create", + "resources": [ + { + "address": "module.create.local_file.data_file", + "mode": "managed", + "name": "data_file", + "provider_name": "registry.terraform.io/hashicorp/local", + "schema_version": 0, + "sensitive_values": {}, + "type": "local_file", + "values": { + "content_base64": null, + "directory_permission": "0777", + "file_permission": "0777", + "sensitive_content": null, + "source": null + } + }, + { + "address": "module.create.random_integer.random", + "mode": "managed", + "name": "random", + "provider_name": "registry.terraform.io/hashicorp/random", + "schema_version": 0, + "sensitive_values": {}, + "type": "random_integer", + "values": { + "keepers": null, + "max": 9999999, + "min": 1000000, + "seed": "F78CB410-BA01-44E1-82E1-37D61F7CB158" + } + } + ] + } + ], + "resources": [ + { + "address": "data.tfcoremock_simple_resource.read", + "mode": "data", + "name": "read", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "integer": null, + "number": null, + "string": null + } + }, + { + "address": "tfcoremock_simple_resource.create", + "mode": "managed", + "name": "create", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "integer": null, + "number": null, + "string": null + } + } + ] + } + }, + "relevant_attributes": [ + { + "attribute": [ + "id" + ], + "resource": "module.create.random_integer.random" + }, + { + "attribute": [ + "string" + ], + "resource": "data.tfcoremock_simple_resource.read" + } + ], + "resource_changes": [ + { + "action_reason": "read_because_config_unknown", + "address": "data.tfcoremock_simple_resource.read", + "change": { + "actions": [ + "read" + ], + "after": { + "bool": null, + "float": null, + "integer": null, + "number": null, + "string": null + }, + "after_sensitive": {}, + "after_unknown": { + "id": true + }, + "before": null, + "before_sensitive": false + }, + "mode": "data", + "name": "read", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + }, + { + "address": "module.create.local_file.data_file", + "change": { + "actions": [ + "create" + ], + "after": { + "content_base64": null, + "directory_permission": "0777", + "file_permission": "0777", + "sensitive_content": null, + "source": null + }, + "after_sensitive": { + "sensitive_content": true + }, + "after_unknown": { + "content": true, + "filename": true, + "id": true + }, + "before": null, + "before_sensitive": false + }, + "mode": "managed", + "module_address": "module.create", + "name": "data_file", + "provider_name": "registry.terraform.io/hashicorp/local", + "type": "local_file" + }, + { + "address": "module.create.random_integer.random", + "change": { + "actions": [ + "create" + ], + "after": { + "keepers": null, + "max": 9999999, + "min": 1000000, + "seed": "F78CB410-BA01-44E1-82E1-37D61F7CB158" + }, + "after_sensitive": {}, + "after_unknown": { + "id": true, + "result": true + }, + "before": null, + "before_sensitive": false + }, + "mode": "managed", + "module_address": "module.create", + "name": "random", + "provider_name": "registry.terraform.io/hashicorp/random", + "type": "random_integer" + }, + { + "address": "tfcoremock_simple_resource.create", + "change": { + "actions": [ + "create" + ], + "after": { + "bool": null, + "float": null, + "integer": null, + "number": null, + "string": null + }, + "after_sensitive": {}, + "after_unknown": { + "id": true + }, + "before": null, + "before_sensitive": false + }, + "mode": "managed", + "name": "create", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_refresh_only/apply.json b/testing/equivalence-tests/outputs/drift_refresh_only/apply.json new file mode 100644 index 000000000000..073332914909 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_refresh_only/apply.json @@ -0,0 +1,21 @@ +[ + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 0 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 0, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_refresh_only/plan b/testing/equivalence-tests/outputs/drift_refresh_only/plan new file mode 100644 index 000000000000..b03117055c53 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_refresh_only/plan @@ -0,0 +1,25 @@ +tfcoremock_simple_resource.drift: Refreshing state... [id=cb79269e-dc39-1e68-0a9c-63cb392afda9] + +Note: Objects have changed outside of Terraform + +Terraform detected the following changes made outside of Terraform since the +last "terraform apply" which may have affected this plan: + + # tfcoremock_simple_resource.drift has changed + ~ resource "tfcoremock_simple_resource" "drift" { + id = "cb79269e-dc39-1e68-0a9c-63cb392afda9" + ~ string = "Hello, world!" -> "Hello, drift!" + } + + +This is a refresh-only plan, so Terraform will not take any actions to undo +these. If you were expecting these changes then you can apply this plan to +record the updated values in the Terraform state without changing any remote +objects. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/drift_refresh_only/plan.json b/testing/equivalence-tests/outputs/drift_refresh_only/plan.json new file mode 100644 index 000000000000..afb164f2c8a6 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_refresh_only/plan.json @@ -0,0 +1,91 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "expressions": { + "string": { + "constant_value": "Hello, world!" + } + }, + "mode": "managed", + "name": "drift", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": {} + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "cb79269e-dc39-1e68-0a9c-63cb392afda9", + "integer": null, + "number": null, + "string": "Hello, drift!" + } + } + ] + } + } + }, + "resource_drift": [ + { + "address": "tfcoremock_simple_resource.drift", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "cb79269e-dc39-1e68-0a9c-63cb392afda9", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "cb79269e-dc39-1e68-0a9c-63cb392afda9", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_refresh_only/state.json b/testing/equivalence-tests/outputs/drift_refresh_only/state.json new file mode 100644 index 000000000000..d91cc99a75dc --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_refresh_only/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "cb79269e-dc39-1e68-0a9c-63cb392afda9", + "integer": null, + "number": null, + "string": "Hello, drift!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_relevant_attributes/apply.json b/testing/equivalence-tests/outputs/drift_relevant_attributes/apply.json new file mode 100644 index 000000000000..68a135562cd9 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_relevant_attributes/apply.json @@ -0,0 +1,139 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_simple_resource.base: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_simple_resource.base", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base", + "resource_key": null, + "resource_name": "base", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.dependent: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_simple_resource.dependent", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.dependent", + "resource_key": null, + "resource_name": "dependent", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.base: Modifying... [id=f6f74ca6-e8ef-e51f-522c-433b9ed5038f]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "resource": { + "addr": "tfcoremock_simple_resource.base", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base", + "resource_key": null, + "resource_name": "base", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.base: Modifications complete after 0s [id=f6f74ca6-e8ef-e51f-522c-433b9ed5038f]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "resource": { + "addr": "tfcoremock_simple_resource.base", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base", + "resource_key": null, + "resource_name": "base", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.dependent: Modifying... [id=1b17b502-96c9-fcc3-3b09-2af1c3de6ad8]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "resource": { + "addr": "tfcoremock_simple_resource.dependent", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.dependent", + "resource_key": null, + "resource_name": "dependent", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.dependent: Modifications complete after 0s [id=1b17b502-96c9-fcc3-3b09-2af1c3de6ad8]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "resource": { + "addr": "tfcoremock_simple_resource.dependent", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.dependent", + "resource_key": null, + "resource_name": "dependent", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 2 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 2, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_relevant_attributes/plan b/testing/equivalence-tests/outputs/drift_relevant_attributes/plan new file mode 100644 index 000000000000..11cf3b62e698 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_relevant_attributes/plan @@ -0,0 +1,47 @@ +tfcoremock_simple_resource.base: Refreshing state... [id=f6f74ca6-e8ef-e51f-522c-433b9ed5038f] +tfcoremock_simple_resource.dependent: Refreshing state... [id=1b17b502-96c9-fcc3-3b09-2af1c3de6ad8] + +Note: Objects have changed outside of Terraform + +Terraform detected the following changes made outside of Terraform since the +last "terraform apply" which may have affected this plan: + + # tfcoremock_simple_resource.base has changed + ~ resource "tfcoremock_simple_resource" "base" { + id = "f6f74ca6-e8ef-e51f-522c-433b9ed5038f" + ~ string = "Hello, world!" -> "Hello, drift!" + } + + +Unless you have made equivalent changes to your configuration, or ignored the +relevant attributes using ignore_changes, the following plan may include +actions to undo or respond to these changes. + +───────────────────────────────────────────────────────────────────────────── + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.base will be updated in-place + ~ resource "tfcoremock_simple_resource" "base" { + id = "f6f74ca6-e8ef-e51f-522c-433b9ed5038f" + ~ string = "Hello, drift!" -> "Hello, change!" + } + + # tfcoremock_simple_resource.dependent will be updated in-place + ~ resource "tfcoremock_simple_resource" "dependent" { + id = "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8" + ~ string = "Hello, world!" -> "Hello, change!" + } + +Plan: 0 to add, 2 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/drift_relevant_attributes/plan.json b/testing/equivalence-tests/outputs/drift_relevant_attributes/plan.json new file mode 100644 index 000000000000..55cb02696221 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_relevant_attributes/plan.json @@ -0,0 +1,236 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base", + "expressions": { + "string": { + "constant_value": "Hello, change!" + } + }, + "mode": "managed", + "name": "base", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + }, + { + "address": "tfcoremock_simple_resource.dependent", + "expressions": { + "string": { + "references": [ + "tfcoremock_simple_resource.base.string", + "tfcoremock_simple_resource.base" + ] + } + }, + "mode": "managed", + "name": "dependent", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base", + "mode": "managed", + "name": "base", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, change!" + } + }, + { + "address": "tfcoremock_simple_resource.dependent", + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "integer": null, + "number": null, + "string": "Hello, change!" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base", + "mode": "managed", + "name": "base", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, drift!" + } + }, + { + "address": "tfcoremock_simple_resource.dependent", + "depends_on": [ + "tfcoremock_simple_resource.base" + ], + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } + }, + "relevant_attributes": [ + { + "attribute": [ + "string" + ], + "resource": "tfcoremock_simple_resource.base" + } + ], + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.base", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, change!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "base", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + }, + { + "address": "tfcoremock_simple_resource.dependent", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "integer": null, + "number": null, + "string": "Hello, change!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ], + "resource_drift": [ + { + "address": "tfcoremock_simple_resource.base", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "base", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_relevant_attributes/state.json b/testing/equivalence-tests/outputs/drift_relevant_attributes/state.json new file mode 100644 index 000000000000..b9b65b6d268a --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_relevant_attributes/state.json @@ -0,0 +1,46 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base", + "mode": "managed", + "name": "base", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": null, + "string": "Hello, change!" + } + }, + { + "address": "tfcoremock_simple_resource.dependent", + "depends_on": [ + "tfcoremock_simple_resource.base" + ], + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "integer": null, + "number": null, + "string": "Hello, change!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_simple/apply.json b/testing/equivalence-tests/outputs/drift_simple/apply.json new file mode 100644 index 000000000000..08353bc21072 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_simple/apply.json @@ -0,0 +1,80 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_simple_resource.drift: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_simple_resource.drift", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.drift", + "resource_key": null, + "resource_name": "drift", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.drift: Modifying... [id=f3c6ddc5-37d5-0170-64ff-518ad421385a]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "resource": { + "addr": "tfcoremock_simple_resource.drift", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.drift", + "resource_key": null, + "resource_name": "drift", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.drift: Modifications complete after 0s [id=f3c6ddc5-37d5-0170-64ff-518ad421385a]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "resource": { + "addr": "tfcoremock_simple_resource.drift", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.drift", + "resource_key": null, + "resource_name": "drift", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 1 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 1, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_simple/plan b/testing/equivalence-tests/outputs/drift_simple/plan new file mode 100644 index 000000000000..266a142e1039 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_simple/plan @@ -0,0 +1,22 @@ +tfcoremock_simple_resource.drift: Refreshing state... [id=f3c6ddc5-37d5-0170-64ff-518ad421385a] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.drift will be updated in-place + ~ resource "tfcoremock_simple_resource" "drift" { + id = "f3c6ddc5-37d5-0170-64ff-518ad421385a" + ~ string = "Hello, drift!" -> "Hello, world!" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/drift_simple/plan.json b/testing/equivalence-tests/outputs/drift_simple/plan.json new file mode 100644 index 000000000000..3eb6d3f241f8 --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_simple/plan.json @@ -0,0 +1,144 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "expressions": { + "string": { + "constant_value": "Hello, world!" + } + }, + "mode": "managed", + "name": "drift", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, drift!" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.drift", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ], + "resource_drift": [ + { + "address": "tfcoremock_simple_resource.drift", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/drift_simple/state.json b/testing/equivalence-tests/outputs/drift_simple/state.json new file mode 100644 index 000000000000..8029de066e1f --- /dev/null +++ b/testing/equivalence-tests/outputs/drift_simple/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.drift", + "mode": "managed", + "name": "drift", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex/apply.json b/testing/equivalence-tests/outputs/fully_populated_complex/apply.json new file mode 100644 index 000000000000..3d2f7d659ff2 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex/apply.json @@ -0,0 +1,78 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Plan to create", + "@module": "terraform.ui", + "change": { + "action": "create", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Creating...", + "@module": "terraform.ui", + "hook": { + "action": "create", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Creation complete after 0s [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A]", + "@module": "terraform.ui", + "hook": { + "action": "create", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 1 added, 0 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 1, + "change": 0, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex/plan b/testing/equivalence-tests/outputs/fully_populated_complex/plan new file mode 100644 index 000000000000..86fb3ae3ed21 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex/plan @@ -0,0 +1,228 @@ + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + + create + +Terraform will perform the following actions: + + # tfcoremock_complex_resource.complex will be created + + resource "tfcoremock_complex_resource" "complex" { + + bool = true + + float = 987654321 + + id = "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + + integer = 987654321 + + list = [ + + { + + string = "this is my first entry in the list, and doesn't contain anything interesting" + }, + + { + + string = <<-EOT + this is my second entry in the list + I am a bit more interesting + and contain multiple lines + EOT + }, + + { + + list = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + + { + + number = 2 + }, + ] + + string = "this is my third entry, and I actually have a nested list" + }, + + { + + set = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + ] + + string = "this is my fourth entry, and I actually have a nested set" + }, + ] + + map = { + + "key_four" = { + + set = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + ] + + string = "this is my fourth entry, and I actually have a nested set" + }, + + "key_one" = { + + string = "this is my first entry in the map, and doesn't contain anything interesting" + }, + + "key_three" = { + + list = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + + { + + number = 2 + }, + ] + + string = "this is my third entry, and I actually have a nested list" + }, + + "key_two" = { + + string = <<-EOT + this is my second entry in the map + I am a bit more interesting + and contain multiple lines + EOT + }, + } + + number = 123456789 + + object = { + + bool = false + + number = 0 + + object = { + + bool = true + + number = 1 + + string = "i am a nested nested object" + } + + string = "i am a nested object" + } + + set = [ + + { + + list = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + + { + + number = 2 + }, + ] + + string = "this is my third entry, and I actually have a nested list" + }, + + { + + set = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + ] + + string = "this is my fourth entry, and I actually have a nested set" + }, + + { + + string = "this is my first entry in the set, and doesn't contain anything interesting" + }, + + { + + string = <<-EOT + this is my second entry in the set + I am a bit more interesting + and contain multiple lines + EOT + }, + ] + + string = "a not very long or complex string" + + + list_block { + + string = jsonencode( + { + + index = 0 + } + ) + } + + list_block { + + list = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + + { + + number = 2 + }, + ] + + string = jsonencode( + { + + index = 1 + } + ) + } + + list_block { + + set = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + ] + + string = jsonencode( + { + + index = 2 + } + ) + } + + + set_block { + + list = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + + { + + number = 2 + }, + ] + + string = jsonencode( + { + + index = 1 + } + ) + } + + set_block { + + set = [ + + { + + number = 0 + }, + + { + + number = 1 + }, + ] + + string = jsonencode( + { + + index = 2 + } + ) + } + + set_block { + + string = jsonencode( + { + + index = 0 + } + ) + } + } + +Plan: 1 to add, 0 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/fully_populated_complex/plan.json b/testing/equivalence-tests/outputs/fully_populated_complex/plan.json new file mode 100644 index 000000000000..8fab5cd66ea3 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex/plan.json @@ -0,0 +1,1544 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "expressions": { + "bool": { + "constant_value": true + }, + "float": { + "constant_value": 987654321 + }, + "id": { + "constant_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + }, + "integer": { + "constant_value": 987654321 + }, + "list": { + "constant_value": [ + { + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + { + "set": [ + { + "number": 0 + }, + { + "number": 1 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ] + }, + "list_block": [ + { + "string": { + "constant_value": "{\"index\":0}" + } + }, + { + "list": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ] + }, + "string": { + "constant_value": "{\"index\":1}" + } + }, + { + "set": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + } + ] + }, + "string": { + "constant_value": "{\"index\":2}" + } + } + ], + "map": { + "constant_value": { + "key_four": { + "set": [ + { + "number": 0 + }, + { + "number": 1 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + } + }, + "number": { + "constant_value": 123456789 + }, + "object": { + "constant_value": { + "bool": false, + "number": 0, + "object": { + "bool": true, + "number": 1, + "string": "i am a nested nested object" + }, + "string": "i am a nested object" + } + }, + "set": { + "constant_value": [ + { + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + }, + { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + { + "set": [ + { + "number": 0 + }, + { + "number": 1 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ] + }, + "set_block": [ + { + "string": { + "constant_value": "{\"index\":0}" + } + }, + { + "list": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ] + }, + "string": { + "constant_value": "{\"index\":1}" + } + }, + { + "set": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + } + ] + }, + "string": { + "constant_value": "{\"index\":2}" + } + } + ], + "string": { + "constant_value": "a not very long or complex string" + } + }, + "mode": "managed", + "name": "complex", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_complex_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "type": "tfcoremock_complex_resource", + "values": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + } + } + ] + } + }, + "resource_changes": [ + { + "address": "tfcoremock_complex_resource.complex", + "change": { + "actions": [ + "create" + ], + "after": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + }, + "after_sensitive": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "after_unknown": {}, + "before": null, + "before_sensitive": false + }, + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_complex_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex/state.json b/testing/equivalence-tests/outputs/fully_populated_complex/state.json new file mode 100644 index 000000000000..e7f3c0671129 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex/state.json @@ -0,0 +1,653 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "type": "tfcoremock_complex_resource", + "values": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_destroy/apply.json b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/apply.json new file mode 100644 index 000000000000..9ed1915a3c81 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/apply.json @@ -0,0 +1,121 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Refreshing state... [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A]", + "@module": "terraform.ui", + "hook": { + "id_key": "id", + "id_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "refresh_start" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Refresh complete [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A]", + "@module": "terraform.ui", + "hook": { + "id_key": "id", + "id_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "refresh_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Plan to delete", + "@module": "terraform.ui", + "change": { + "action": "delete", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "Plan: 0 to add, 0 to change, 1 to destroy.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 0, + "operation": "plan", + "remove": 1 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Destroying... [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A]", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "id_key": "id", + "id_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Destruction complete after 0s", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "elapsed_seconds": 0, + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Destroy complete! Resources: 1 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 0, + "operation": "destroy", + "remove": 1 + }, + "type": "change_summary" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan new file mode 100644 index 000000000000..1d460ada0eb0 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan @@ -0,0 +1,229 @@ +tfcoremock_complex_resource.complex: Refreshing state... [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + - destroy + +Terraform will perform the following actions: + + # tfcoremock_complex_resource.complex will be destroyed + - resource "tfcoremock_complex_resource" "complex" { + - bool = true -> null + - float = 987654321 -> null + - id = "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" -> null + - integer = 987654321 -> null + - list = [ + - { + - string = "this is my first entry in the list, and doesn't contain anything interesting" -> null + }, + - { + - string = <<-EOT + this is my second entry in the list + I am a bit more interesting + and contain multiple lines + EOT -> null + }, + - { + - list = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + - { + - number = 2 -> null + }, + ] -> null + - string = "this is my third entry, and I actually have a nested list" -> null + }, + - { + - set = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + ] -> null + - string = "this is my fourth entry, and I actually have a nested set" -> null + }, + ] -> null + - map = { + - "key_four" = { + - set = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + ] -> null + - string = "this is my fourth entry, and I actually have a nested set" -> null + }, + - "key_one" = { + - string = "this is my first entry in the map, and doesn't contain anything interesting" -> null + }, + - "key_three" = { + - list = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + - { + - number = 2 -> null + }, + ] -> null + - string = "this is my third entry, and I actually have a nested list" -> null + }, + - "key_two" = { + - string = <<-EOT + this is my second entry in the map + I am a bit more interesting + and contain multiple lines + EOT -> null + }, + } + - number = 123456789 -> null + - object = { + - bool = false -> null + - number = 0 -> null + - object = { + - bool = true -> null + - number = 1 -> null + - string = "i am a nested nested object" -> null + } -> null + - string = "i am a nested object" -> null + } -> null + - set = [ + - { + - list = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + - { + - number = 2 -> null + }, + ] -> null + - string = "this is my third entry, and I actually have a nested list" -> null + }, + - { + - set = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + ] -> null + - string = "this is my fourth entry, and I actually have a nested set" -> null + }, + - { + - string = "this is my first entry in the set, and doesn't contain anything interesting" -> null + }, + - { + - string = <<-EOT + this is my second entry in the set + I am a bit more interesting + and contain multiple lines + EOT -> null + }, + ] -> null + - string = "a not very long or complex string" -> null + + - list_block { + - string = jsonencode( + { + - index = 0 + } + ) -> null + } + - list_block { + - list = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + - { + - number = 2 -> null + }, + ] -> null + - string = jsonencode( + { + - index = 1 + } + ) -> null + } + - list_block { + - set = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + ] -> null + - string = jsonencode( + { + - index = 2 + } + ) -> null + } + + - set_block { + - list = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + - { + - number = 2 -> null + }, + ] -> null + - string = jsonencode( + { + - index = 1 + } + ) -> null + } + - set_block { + - set = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + ] -> null + - string = jsonencode( + { + - index = 2 + } + ) -> null + } + - set_block { + - string = jsonencode( + { + - index = 0 + } + ) -> null + } + } + +Plan: 0 to add, 0 to change, 1 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan.json b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan.json new file mode 100644 index 000000000000..a5132b27949b --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/plan.json @@ -0,0 +1,1545 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "expressions": { + "bool": { + "constant_value": true + }, + "float": { + "constant_value": 123456789 + }, + "id": { + "constant_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + }, + "integer": { + "constant_value": 123456789 + }, + "list": { + "constant_value": [ + { + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 3 + }, + { + "number": 4 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + { + "set": [ + { + "number": 0 + }, + { + "number": 2 + } + ], + "string": "this is my fourth entry, and I actually have a nested set and I edited my test" + } + ] + }, + "list_block": [ + { + "string": { + "constant_value": "{\"index\":0}" + } + }, + { + "list": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ] + }, + "string": { + "constant_value": "{\"index\":1}" + } + } + ], + "map": { + "constant_value": { + "key_four": { + "set": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 3 + }, + { + "number": 4 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "list": [ + { + "number": 0 + }, + { + "number": 3 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + } + }, + "number": { + "constant_value": 987654321 + }, + "object": { + "constant_value": { + "number": 0, + "object": { + "bool": true, + "string": "i am a nested nested object" + }, + "string": "i am a nested object" + } + }, + "set": { + "constant_value": [ + { + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + }, + { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + { + "set": [ + { + "number": 0 + }, + { + "number": 1 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ] + }, + "set_block": [ + { + "list": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ] + }, + "string": { + "constant_value": "{\"index\":1}" + } + }, + { + "set": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + } + ] + }, + "string": { + "constant_value": "{\"index\":2}" + } + }, + { + "string": { + "constant_value": "{\"index\":3}" + } + } + ], + "string": { + "constant_value": "a not very long or complex string" + } + }, + "mode": "managed", + "name": "complex", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_complex_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": {} + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "type": "tfcoremock_complex_resource", + "values": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_complex_resource.complex", + "change": { + "actions": [ + "delete" + ], + "after": null, + "after_sensitive": false, + "after_unknown": {}, + "before": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + }, + "before_sensitive": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + } + }, + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_complex_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_destroy/state.json b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/state.json new file mode 100644 index 000000000000..00f8f1ca3632 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_destroy/state.json @@ -0,0 +1,3 @@ +{ + "format_version": "1.0" +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_update/apply.json b/testing/equivalence-tests/outputs/fully_populated_complex_update/apply.json new file mode 100644 index 000000000000..fd7aacaad6d8 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_update/apply.json @@ -0,0 +1,80 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Modifying... [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_complex_resource.complex: Modifications complete after 0s [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "resource": { + "addr": "tfcoremock_complex_resource.complex", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_complex_resource.complex", + "resource_key": null, + "resource_name": "complex", + "resource_type": "tfcoremock_complex_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 1 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 1, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_update/plan b/testing/equivalence-tests/outputs/fully_populated_complex_update/plan new file mode 100644 index 000000000000..ae45cfa5b67d --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_update/plan @@ -0,0 +1,131 @@ +tfcoremock_complex_resource.complex: Refreshing state... [id=64564E36-BFCB-458B-9405-EBBF6A3CAC7A] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_complex_resource.complex will be updated in-place + ~ resource "tfcoremock_complex_resource" "complex" { + ~ float = 987654321 -> 123456789 + id = "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + ~ integer = 987654321 -> 123456789 + ~ list = [ + ~ { + ~ string = <<-EOT + this is my second entry in the list + I am a bit more interesting + and contain multiple lines + + but I've been edited + EOT + }, + ~ { + ~ list = [ + ~ { + ~ number = 2 -> 3 + }, + + { + + number = 4 + }, + # (2 unchanged elements hidden) + ] + # (1 unchanged attribute hidden) + }, + ~ { + ~ set = [ + - { + - number = 1 -> null + }, + + { + + number = 2 + }, + # (1 unchanged element hidden) + ] + ~ string = "this is my fourth entry, and I actually have a nested set" -> "this is my fourth entry, and I actually have a nested set and I edited my test" + }, + # (1 unchanged element hidden) + ] + ~ map = { + ~ "key_four" = { + ~ set = [ + + { + + number = 3 + }, + + { + + number = 4 + }, + # (2 unchanged elements hidden) + ] + # (1 unchanged attribute hidden) + }, + ~ "key_three" = { + ~ list = [ + ~ { + ~ number = 1 -> 3 + }, + ~ { + ~ number = 2 -> 1 + }, + + { + + number = 2 + }, + # (1 unchanged element hidden) + ] + # (2 unchanged attributes hidden) + }, + # (2 unchanged elements hidden) + } + ~ number = 123456789 -> 987654321 + ~ object = { + - bool = false -> null + ~ object = { + - number = 1 -> null + # (2 unchanged attributes hidden) + } + # (2 unchanged attributes hidden) + } + # (3 unchanged attributes hidden) + + - list_block { + - set = [ + - { + - number = 0 -> null + }, + - { + - number = 1 -> null + }, + ] -> null + - string = jsonencode( + { + - index = 2 + } + ) -> null + } + + - set_block { + - string = jsonencode( + { + - index = 0 + } + ) -> null + } + + set_block { + + string = jsonencode( + { + + index = 3 + } + ) + } + + # (4 unchanged blocks hidden) + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_update/plan.json b/testing/equivalence-tests/outputs/fully_populated_complex_update/plan.json new file mode 100644 index 000000000000..1cb34fd16305 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_update/plan.json @@ -0,0 +1,2834 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "expressions": { + "bool": { + "constant_value": true + }, + "float": { + "constant_value": 123456789 + }, + "id": { + "constant_value": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + }, + "integer": { + "constant_value": 123456789 + }, + "list": { + "constant_value": [ + { + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 3 + }, + { + "number": 4 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + { + "set": [ + { + "number": 0 + }, + { + "number": 2 + } + ], + "string": "this is my fourth entry, and I actually have a nested set and I edited my test" + } + ] + }, + "list_block": [ + { + "string": { + "constant_value": "{\"index\":0}" + } + }, + { + "list": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ] + }, + "string": { + "constant_value": "{\"index\":1}" + } + } + ], + "map": { + "constant_value": { + "key_four": { + "set": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 3 + }, + { + "number": 4 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "list": [ + { + "number": 0 + }, + { + "number": 3 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + } + }, + "number": { + "constant_value": 987654321 + }, + "object": { + "constant_value": { + "number": 0, + "object": { + "bool": true, + "string": "i am a nested nested object" + }, + "string": "i am a nested object" + } + }, + "set": { + "constant_value": [ + { + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + }, + { + "list": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ], + "string": "this is my third entry, and I actually have a nested list" + }, + { + "set": [ + { + "number": 0 + }, + { + "number": 1 + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ] + }, + "set_block": [ + { + "list": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + }, + { + "number": 2 + } + ] + }, + "string": { + "constant_value": "{\"index\":1}" + } + }, + { + "set": { + "constant_value": [ + { + "number": 0 + }, + { + "number": 1 + } + ] + }, + "string": { + "constant_value": "{\"index\":2}" + } + }, + { + "string": { + "constant_value": "{\"index\":3}" + } + } + ], + "string": { + "constant_value": "a not very long or complex string" + } + }, + "mode": "managed", + "name": "complex", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_complex_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {}, + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "type": "tfcoremock_complex_resource", + "values": { + "bool": true, + "float": 123456789, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 123456789, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 4, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set and I edited my test" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 4, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 987654321, + "object": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":3}" + } + ], + "string": "a not very long or complex string" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "type": "tfcoremock_complex_resource", + "values": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_complex_resource.complex", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": true, + "float": 123456789, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 123456789, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 4, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set and I edited my test" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 4, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 987654321, + "object": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":3}" + } + ], + "string": "a not very long or complex string" + }, + "after_sensitive": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {}, + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "after_unknown": {}, + "before": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + }, + "before_sensitive": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + } + }, + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_complex_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/fully_populated_complex_update/state.json b/testing/equivalence-tests/outputs/fully_populated_complex_update/state.json new file mode 100644 index 000000000000..95a967d84fb6 --- /dev/null +++ b/testing/equivalence-tests/outputs/fully_populated_complex_update/state.json @@ -0,0 +1,657 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_complex_resource.complex", + "mode": "managed", + "name": "complex", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + { + "list": [ + {}, + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + } + ], + "list_block": [ + { + "list_block": [], + "set_block": [] + }, + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + } + ], + "map": { + "key_four": { + "set": [ + {}, + {}, + {}, + {} + ] + }, + "key_one": {}, + "key_three": { + "list": [ + {}, + {}, + {}, + {} + ] + }, + "key_two": {} + }, + "object": { + "object": {} + }, + "set": [ + { + "list": [ + {}, + {}, + {} + ] + }, + { + "set": [ + {}, + {} + ] + }, + {}, + {} + ], + "set_block": [ + { + "list": [ + {}, + {}, + {} + ], + "list_block": [], + "set_block": [] + }, + { + "list_block": [], + "set": [ + {}, + {} + ], + "set_block": [] + }, + { + "list_block": [], + "set_block": [] + } + ] + }, + "type": "tfcoremock_complex_resource", + "values": { + "bool": true, + "float": 123456789, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 123456789, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 4, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set and I edited my test" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 4, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 3, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 987654321, + "object": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":3}" + } + ], + "string": "a not very long or complex string" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_simple/apply.json b/testing/equivalence-tests/outputs/moved_simple/apply.json new file mode 100644 index 000000000000..073332914909 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_simple/apply.json @@ -0,0 +1,21 @@ +[ + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 0 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 0, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_simple/plan b/testing/equivalence-tests/outputs/moved_simple/plan new file mode 100644 index 000000000000..083308b345ba --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_simple/plan @@ -0,0 +1,18 @@ +tfcoremock_simple_resource.second: Refreshing state... [id=70c47571-66c3-b1dc-2474-47a74b9c7886] + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.first has moved to tfcoremock_simple_resource.second + resource "tfcoremock_simple_resource" "second" { + id = "70c47571-66c3-b1dc-2474-47a74b9c7886" + # (1 unchanged attribute hidden) + } + +Plan: 0 to add, 0 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/moved_simple/plan.json b/testing/equivalence-tests/outputs/moved_simple/plan.json new file mode 100644 index 000000000000..bf2df76059f4 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_simple/plan.json @@ -0,0 +1,112 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "expressions": { + "string": { + "constant_value": "Hello, world!" + } + }, + "mode": "managed", + "name": "second", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "mode": "managed", + "name": "second", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "mode": "managed", + "name": "second", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.second", + "change": { + "actions": [ + "no-op" + ], + "after": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "second", + "previous_address": "tfcoremock_simple_resource.first", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_simple/state.json b/testing/equivalence-tests/outputs/moved_simple/state.json new file mode 100644 index 000000000000..84cdbee6fdbe --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_simple/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "mode": "managed", + "name": "second", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_drift/apply.json b/testing/equivalence-tests/outputs/moved_with_drift/apply.json new file mode 100644 index 000000000000..55dc6104ddca --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_drift/apply.json @@ -0,0 +1,148 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_simple_resource.base_after: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "previous_resource": { + "addr": "tfcoremock_simple_resource.base_before", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base_before", + "resource_key": null, + "resource_name": "base_before", + "resource_type": "tfcoremock_simple_resource" + }, + "resource": { + "addr": "tfcoremock_simple_resource.base_after", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base_after", + "resource_key": null, + "resource_name": "base_after", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.dependent: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "resource": { + "addr": "tfcoremock_simple_resource.dependent", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.dependent", + "resource_key": null, + "resource_name": "dependent", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.base_after: Modifying... [id=e450ef2f-b80f-0cce-8bdb-14d88f48649c]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "resource": { + "addr": "tfcoremock_simple_resource.base_after", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base_after", + "resource_key": null, + "resource_name": "base_after", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.base_after: Modifications complete after 0s [id=e450ef2f-b80f-0cce-8bdb-14d88f48649c]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "resource": { + "addr": "tfcoremock_simple_resource.base_after", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base_after", + "resource_key": null, + "resource_name": "base_after", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.dependent: Modifying... [id=2ecc718c-8d04-5774-5c36-7d69bf77d34e]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "resource": { + "addr": "tfcoremock_simple_resource.dependent", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.dependent", + "resource_key": null, + "resource_name": "dependent", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.dependent: Modifications complete after 0s [id=2ecc718c-8d04-5774-5c36-7d69bf77d34e]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "resource": { + "addr": "tfcoremock_simple_resource.dependent", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.dependent", + "resource_key": null, + "resource_name": "dependent", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 2 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 2, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_drift/plan b/testing/equivalence-tests/outputs/moved_with_drift/plan new file mode 100644 index 000000000000..0293566d57ae --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_drift/plan @@ -0,0 +1,49 @@ +tfcoremock_simple_resource.base_after: Refreshing state... [id=e450ef2f-b80f-0cce-8bdb-14d88f48649c] +tfcoremock_simple_resource.dependent: Refreshing state... [id=2ecc718c-8d04-5774-5c36-7d69bf77d34e] + +Note: Objects have changed outside of Terraform + +Terraform detected the following changes made outside of Terraform since the +last "terraform apply" which may have affected this plan: + + # tfcoremock_simple_resource.base_after has changed + # (moved from tfcoremock_simple_resource.base_before) + ~ resource "tfcoremock_simple_resource" "base_after" { + id = "e450ef2f-b80f-0cce-8bdb-14d88f48649c" + ~ string = "Hello, world!" -> "Hello, drift!" + } + + +Unless you have made equivalent changes to your configuration, or ignored the +relevant attributes using ignore_changes, the following plan may include +actions to undo or respond to these changes. + +───────────────────────────────────────────────────────────────────────────── + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.base_after will be updated in-place + # (moved from tfcoremock_simple_resource.base_before) + ~ resource "tfcoremock_simple_resource" "base_after" { + id = "e450ef2f-b80f-0cce-8bdb-14d88f48649c" + ~ string = "Hello, drift!" -> "Hello, change!" + } + + # tfcoremock_simple_resource.dependent will be updated in-place + ~ resource "tfcoremock_simple_resource" "dependent" { + id = "2ecc718c-8d04-5774-5c36-7d69bf77d34e" + ~ string = "Hello, world!" -> "Hello, change!" + } + +Plan: 0 to add, 2 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/moved_with_drift/plan.json b/testing/equivalence-tests/outputs/moved_with_drift/plan.json new file mode 100644 index 000000000000..8f5bb0c81d49 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_drift/plan.json @@ -0,0 +1,239 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base_after", + "expressions": { + "string": { + "constant_value": "Hello, change!" + } + }, + "mode": "managed", + "name": "base_after", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + }, + { + "address": "tfcoremock_simple_resource.dependent", + "expressions": { + "string": { + "references": [ + "tfcoremock_simple_resource.base_after.string", + "tfcoremock_simple_resource.base_after" + ] + } + }, + "mode": "managed", + "name": "dependent", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base_after", + "mode": "managed", + "name": "base_after", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, change!" + } + }, + { + "address": "tfcoremock_simple_resource.dependent", + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "integer": null, + "number": null, + "string": "Hello, change!" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base_after", + "mode": "managed", + "name": "base_after", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, drift!" + } + }, + { + "address": "tfcoremock_simple_resource.dependent", + "depends_on": [ + "tfcoremock_simple_resource.base_after", + "tfcoremock_simple_resource.base_before" + ], + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } + }, + "relevant_attributes": [ + { + "attribute": [ + "string" + ], + "resource": "tfcoremock_simple_resource.base_after" + } + ], + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.base_after", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, change!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "base_after", + "previous_address": "tfcoremock_simple_resource.base_before", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + }, + { + "address": "tfcoremock_simple_resource.dependent", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "integer": null, + "number": null, + "string": "Hello, change!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ], + "resource_drift": [ + { + "address": "tfcoremock_simple_resource.base_after", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, drift!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "base_after", + "previous_address": "tfcoremock_simple_resource.base_before", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_drift/state.json b/testing/equivalence-tests/outputs/moved_with_drift/state.json new file mode 100644 index 000000000000..e1303bed58cf --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_drift/state.json @@ -0,0 +1,46 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.base_after", + "mode": "managed", + "name": "base_after", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, change!" + } + }, + { + "address": "tfcoremock_simple_resource.dependent", + "depends_on": [ + "tfcoremock_simple_resource.base_after" + ], + "mode": "managed", + "name": "dependent", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "integer": null, + "number": null, + "string": "Hello, change!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_refresh_only/apply.json b/testing/equivalence-tests/outputs/moved_with_refresh_only/apply.json new file mode 100644 index 000000000000..073332914909 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_refresh_only/apply.json @@ -0,0 +1,21 @@ +[ + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 0 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 0, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_refresh_only/plan b/testing/equivalence-tests/outputs/moved_with_refresh_only/plan new file mode 100644 index 000000000000..441ec4994c2b --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_refresh_only/plan @@ -0,0 +1,18 @@ +tfcoremock_simple_resource.second: Refreshing state... [id=70c47571-66c3-b1dc-2474-47a74b9c7886] + +Note: Objects have changed outside of Terraform + +Terraform detected the following changes made outside of Terraform since the +last "terraform apply" which may have affected this plan: + + # tfcoremock_simple_resource.first has moved to tfcoremock_simple_resource.second + resource "tfcoremock_simple_resource" "second" { + id = "70c47571-66c3-b1dc-2474-47a74b9c7886" + # (1 unchanged attribute hidden) + } + + +This is a refresh-only plan, so Terraform will not take any actions to undo +these. If you were expecting these changes then you can apply this plan to +record the updated values in the Terraform state without changing any remote +objects. diff --git a/testing/equivalence-tests/outputs/moved_with_refresh_only/plan.json b/testing/equivalence-tests/outputs/moved_with_refresh_only/plan.json new file mode 100644 index 000000000000..9b99965a1139 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_refresh_only/plan.json @@ -0,0 +1,92 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "expressions": { + "string": { + "constant_value": "Hello, world!" + } + }, + "mode": "managed", + "name": "second", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": {} + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "mode": "managed", + "name": "second", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } + }, + "resource_drift": [ + { + "address": "tfcoremock_simple_resource.second", + "change": { + "actions": [ + "no-op" + ], + "after": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "second", + "previous_address": "tfcoremock_simple_resource.first", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_refresh_only/state.json b/testing/equivalence-tests/outputs/moved_with_refresh_only/state.json new file mode 100644 index 000000000000..84cdbee6fdbe --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_refresh_only/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.second", + "mode": "managed", + "name": "second", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_update/apply.json b/testing/equivalence-tests/outputs/moved_with_update/apply.json new file mode 100644 index 000000000000..259c7f8b8146 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_update/apply.json @@ -0,0 +1,89 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_simple_resource.moved: Plan to update", + "@module": "terraform.ui", + "change": { + "action": "update", + "previous_resource": { + "addr": "tfcoremock_simple_resource.base", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.base", + "resource_key": null, + "resource_name": "base", + "resource_type": "tfcoremock_simple_resource" + }, + "resource": { + "addr": "tfcoremock_simple_resource.moved", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.moved", + "resource_key": null, + "resource_name": "moved", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.moved: Modifying... [id=7da63aeb-f908-a112-9886-f29a0b0bd4ad]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "id_key": "id", + "id_value": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "resource": { + "addr": "tfcoremock_simple_resource.moved", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.moved", + "resource_key": null, + "resource_name": "moved", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_simple_resource.moved: Modifications complete after 0s [id=7da63aeb-f908-a112-9886-f29a0b0bd4ad]", + "@module": "terraform.ui", + "hook": { + "action": "update", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "resource": { + "addr": "tfcoremock_simple_resource.moved", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_simple_resource.moved", + "resource_key": null, + "resource_name": "moved", + "resource_type": "tfcoremock_simple_resource" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 0 added, 1 changed, 0 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 0, + "change": 1, + "operation": "apply", + "remove": 0 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_update/plan b/testing/equivalence-tests/outputs/moved_with_update/plan new file mode 100644 index 000000000000..eab173770c08 --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_update/plan @@ -0,0 +1,23 @@ +tfcoremock_simple_resource.moved: Refreshing state... [id=7da63aeb-f908-a112-9886-f29a0b0bd4ad] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: + ~ update in-place + +Terraform will perform the following actions: + + # tfcoremock_simple_resource.moved will be updated in-place + # (moved from tfcoremock_simple_resource.base) + ~ resource "tfcoremock_simple_resource" "moved" { + id = "7da63aeb-f908-a112-9886-f29a0b0bd4ad" + ~ string = "Hello, world!" -> "Hello, change!" + } + +Plan: 0 to add, 1 to change, 0 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/moved_with_update/plan.json b/testing/equivalence-tests/outputs/moved_with_update/plan.json new file mode 100644 index 000000000000..3c6cf7bd12fd --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_update/plan.json @@ -0,0 +1,112 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.moved", + "expressions": { + "string": { + "constant_value": "Hello, change!" + } + }, + "mode": "managed", + "name": "moved", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_simple_resource" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.moved", + "mode": "managed", + "name": "moved", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "integer": null, + "number": null, + "string": "Hello, change!" + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.moved", + "mode": "managed", + "name": "moved", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "integer": null, + "number": null, + "string": "Hello, world!" + } + } + ] + } + } + }, + "resource_changes": [ + { + "address": "tfcoremock_simple_resource.moved", + "change": { + "actions": [ + "update" + ], + "after": { + "bool": null, + "float": null, + "id": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "integer": null, + "number": null, + "string": "Hello, change!" + }, + "after_sensitive": {}, + "after_unknown": {}, + "before": { + "bool": null, + "float": null, + "id": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "before_sensitive": {} + }, + "mode": "managed", + "name": "moved", + "previous_address": "tfcoremock_simple_resource.base", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_simple_resource" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/moved_with_update/state.json b/testing/equivalence-tests/outputs/moved_with_update/state.json new file mode 100644 index 000000000000..406616c3dbcc --- /dev/null +++ b/testing/equivalence-tests/outputs/moved_with_update/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_simple_resource.moved", + "mode": "managed", + "name": "moved", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": {}, + "type": "tfcoremock_simple_resource", + "values": { + "bool": null, + "float": null, + "id": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "integer": null, + "number": null, + "string": "Hello, change!" + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_list/apply.json b/testing/equivalence-tests/outputs/replace_within_list/apply.json new file mode 100644 index 000000000000..c22e4cda9d9a --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_list/apply.json @@ -0,0 +1,118 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_list.list: Plan to replace", + "@module": "terraform.ui", + "change": { + "action": "replace", + "reason": "cannot_update", + "resource": { + "addr": "tfcoremock_list.list", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_list.list", + "resource_key": null, + "resource_name": "list", + "resource_type": "tfcoremock_list" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_list.list: Destroying... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_list.list", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_list.list", + "resource_key": null, + "resource_name": "list", + "resource_type": "tfcoremock_list" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_list.list: Destruction complete after 0s", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "elapsed_seconds": 0, + "resource": { + "addr": "tfcoremock_list.list", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_list.list", + "resource_key": null, + "resource_name": "list", + "resource_type": "tfcoremock_list" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_list.list: Creating...", + "@module": "terraform.ui", + "hook": { + "action": "create", + "resource": { + "addr": "tfcoremock_list.list", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_list.list", + "resource_key": null, + "resource_name": "list", + "resource_type": "tfcoremock_list" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_list.list: Creation complete after 0s [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "create", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_list.list", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_list.list", + "resource_key": null, + "resource_name": "list", + "resource_type": "tfcoremock_list" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 1 added, 0 changed, 1 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 1, + "change": 0, + "operation": "apply", + "remove": 1 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_list/plan b/testing/equivalence-tests/outputs/replace_within_list/plan new file mode 100644 index 000000000000..e5c73a3fe313 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_list/plan @@ -0,0 +1,27 @@ +tfcoremock_list.list: Refreshing state... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: +-/+ destroy and then create replacement + +Terraform will perform the following actions: + + # tfcoremock_list.list must be replaced +-/+ resource "tfcoremock_list" "list" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + ~ list = [ + ~ { + ~ id = "6A8C6A29-D417-480A-BE19-12D7398B3178" -> "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" # forces replacement + }, + # (2 unchanged elements hidden) + ] + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/replace_within_list/plan.json b/testing/equivalence-tests/outputs/replace_within_list/plan.json new file mode 100644 index 000000000000..4918f9a87c5a --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_list/plan.json @@ -0,0 +1,181 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_list.list", + "expressions": { + "id": { + "constant_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "list": { + "constant_value": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + }, + "mode": "managed", + "name": "list", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_list" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_list.list", + "mode": "managed", + "name": "list", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + {} + ] + }, + "type": "tfcoremock_list", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "list": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_list.list", + "mode": "managed", + "name": "list", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + {} + ] + }, + "type": "tfcoremock_list", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "list": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "6A8C6A29-D417-480A-BE19-12D7398B3178" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + } + ] + } + } + }, + "resource_changes": [ + { + "action_reason": "replace_because_cannot_update", + "address": "tfcoremock_list.list", + "change": { + "actions": [ + "delete", + "create" + ], + "after": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "list": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + }, + "after_sensitive": { + "list": [ + {}, + {}, + {} + ] + }, + "after_unknown": {}, + "before": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "list": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "6A8C6A29-D417-480A-BE19-12D7398B3178" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + }, + "before_sensitive": { + "list": [ + {}, + {}, + {} + ] + }, + "replace_paths": [ + [ + "list", + 1, + "id" + ] + ] + }, + "mode": "managed", + "name": "list", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_list" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_list/state.json b/testing/equivalence-tests/outputs/replace_within_list/state.json new file mode 100644 index 000000000000..b4a486baacb4 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_list/state.json @@ -0,0 +1,38 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_list.list", + "mode": "managed", + "name": "list", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "list": [ + {}, + {}, + {} + ] + }, + "type": "tfcoremock_list", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "list": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_map/apply.json b/testing/equivalence-tests/outputs/replace_within_map/apply.json new file mode 100644 index 000000000000..70c8f8db75e1 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_map/apply.json @@ -0,0 +1,118 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_map.map: Plan to replace", + "@module": "terraform.ui", + "change": { + "action": "replace", + "reason": "cannot_update", + "resource": { + "addr": "tfcoremock_map.map", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_map.map", + "resource_key": null, + "resource_name": "map", + "resource_type": "tfcoremock_map" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_map.map: Destroying... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_map.map", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_map.map", + "resource_key": null, + "resource_name": "map", + "resource_type": "tfcoremock_map" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_map.map: Destruction complete after 0s", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "elapsed_seconds": 0, + "resource": { + "addr": "tfcoremock_map.map", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_map.map", + "resource_key": null, + "resource_name": "map", + "resource_type": "tfcoremock_map" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_map.map: Creating...", + "@module": "terraform.ui", + "hook": { + "action": "create", + "resource": { + "addr": "tfcoremock_map.map", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_map.map", + "resource_key": null, + "resource_name": "map", + "resource_type": "tfcoremock_map" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_map.map: Creation complete after 0s [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "create", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_map.map", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_map.map", + "resource_key": null, + "resource_name": "map", + "resource_type": "tfcoremock_map" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 1 added, 0 changed, 1 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 1, + "change": 0, + "operation": "apply", + "remove": 1 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_map/plan b/testing/equivalence-tests/outputs/replace_within_map/plan new file mode 100644 index 000000000000..46ab58c66530 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_map/plan @@ -0,0 +1,27 @@ +tfcoremock_map.map: Refreshing state... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: +-/+ destroy and then create replacement + +Terraform will perform the following actions: + + # tfcoremock_map.map must be replaced +-/+ resource "tfcoremock_map" "map" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + ~ map = { + ~ "key_two" = { + ~ id = "56C7E07F-B9DF-4799-AF62-E703D1167A51" -> "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" # forces replacement + }, + # (2 unchanged elements hidden) + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/replace_within_map/plan.json b/testing/equivalence-tests/outputs/replace_within_map/plan.json new file mode 100644 index 000000000000..f0e1a08f0167 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_map/plan.json @@ -0,0 +1,181 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_map.map", + "expressions": { + "id": { + "constant_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "map": { + "constant_value": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + } + }, + "mode": "managed", + "name": "map", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_map" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_map.map", + "mode": "managed", + "name": "map", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "map": { + "key_one": {}, + "key_three": {}, + "key_two": {} + } + }, + "type": "tfcoremock_map", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "map": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_map.map", + "mode": "managed", + "name": "map", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "map": { + "key_one": {}, + "key_three": {}, + "key_two": {} + } + }, + "type": "tfcoremock_map", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "map": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + } + } + ] + } + } + }, + "resource_changes": [ + { + "action_reason": "replace_because_cannot_update", + "address": "tfcoremock_map.map", + "change": { + "actions": [ + "delete", + "create" + ], + "after": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "map": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + }, + "after_sensitive": { + "map": { + "key_one": {}, + "key_three": {}, + "key_two": {} + } + }, + "after_unknown": {}, + "before": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "map": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + }, + "before_sensitive": { + "map": { + "key_one": {}, + "key_three": {}, + "key_two": {} + } + }, + "replace_paths": [ + [ + "map", + "key_two", + "id" + ] + ] + }, + "mode": "managed", + "name": "map", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_map" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_map/state.json b/testing/equivalence-tests/outputs/replace_within_map/state.json new file mode 100644 index 000000000000..02fae77fe687 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_map/state.json @@ -0,0 +1,38 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_map.map", + "mode": "managed", + "name": "map", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "map": { + "key_one": {}, + "key_three": {}, + "key_two": {} + } + }, + "type": "tfcoremock_map", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "map": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_object/apply.json b/testing/equivalence-tests/outputs/replace_within_object/apply.json new file mode 100644 index 000000000000..c780128155a0 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_object/apply.json @@ -0,0 +1,118 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_object.object: Plan to replace", + "@module": "terraform.ui", + "change": { + "action": "replace", + "reason": "cannot_update", + "resource": { + "addr": "tfcoremock_object.object", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_object.object", + "resource_key": null, + "resource_name": "object", + "resource_type": "tfcoremock_object" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_object.object: Destroying... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_object.object", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_object.object", + "resource_key": null, + "resource_name": "object", + "resource_type": "tfcoremock_object" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_object.object: Destruction complete after 0s", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "elapsed_seconds": 0, + "resource": { + "addr": "tfcoremock_object.object", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_object.object", + "resource_key": null, + "resource_name": "object", + "resource_type": "tfcoremock_object" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_object.object: Creating...", + "@module": "terraform.ui", + "hook": { + "action": "create", + "resource": { + "addr": "tfcoremock_object.object", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_object.object", + "resource_key": null, + "resource_name": "object", + "resource_type": "tfcoremock_object" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_object.object: Creation complete after 0s [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "create", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_object.object", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_object.object", + "resource_key": null, + "resource_name": "object", + "resource_type": "tfcoremock_object" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 1 added, 0 changed, 1 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 1, + "change": 0, + "operation": "apply", + "remove": 1 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_object/plan b/testing/equivalence-tests/outputs/replace_within_object/plan new file mode 100644 index 000000000000..2df539c6e478 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_object/plan @@ -0,0 +1,24 @@ +tfcoremock_object.object: Refreshing state... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: +-/+ destroy and then create replacement + +Terraform will perform the following actions: + + # tfcoremock_object.object must be replaced +-/+ resource "tfcoremock_object" "object" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + ~ object = { + ~ id = "56C7E07F-B9DF-4799-AF62-E703D1167A51" -> "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" # forces replacement + } + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/replace_within_object/plan.json b/testing/equivalence-tests/outputs/replace_within_object/plan.json new file mode 100644 index 000000000000..2ab59e9d05ef --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_object/plan.json @@ -0,0 +1,124 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_object.object", + "expressions": { + "id": { + "constant_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "object": { + "constant_value": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + }, + "mode": "managed", + "name": "object", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_object" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_object.object", + "mode": "managed", + "name": "object", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "object": {} + }, + "type": "tfcoremock_object", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "object": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_object.object", + "mode": "managed", + "name": "object", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "object": {} + }, + "type": "tfcoremock_object", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "object": { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + } + ] + } + } + }, + "resource_changes": [ + { + "action_reason": "replace_because_cannot_update", + "address": "tfcoremock_object.object", + "change": { + "actions": [ + "delete", + "create" + ], + "after": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "object": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + }, + "after_sensitive": { + "object": {} + }, + "after_unknown": {}, + "before": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "object": { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + }, + "before_sensitive": { + "object": {} + }, + "replace_paths": [ + [ + "object", + "id" + ] + ] + }, + "mode": "managed", + "name": "object", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_object" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_object/state.json b/testing/equivalence-tests/outputs/replace_within_object/state.json new file mode 100644 index 000000000000..a2f7433ee5cc --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_object/state.json @@ -0,0 +1,26 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_object.object", + "mode": "managed", + "name": "object", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "object": {} + }, + "type": "tfcoremock_object", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "object": { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_set/apply.json b/testing/equivalence-tests/outputs/replace_within_set/apply.json new file mode 100644 index 000000000000..ce4614109f94 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_set/apply.json @@ -0,0 +1,118 @@ +[ + { + "@level": "info", + "@message": "tfcoremock_set.set: Plan to replace", + "@module": "terraform.ui", + "change": { + "action": "replace", + "reason": "cannot_update", + "resource": { + "addr": "tfcoremock_set.set", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_set.set", + "resource_key": null, + "resource_name": "set", + "resource_type": "tfcoremock_set" + } + }, + "type": "planned_change" + }, + { + "@level": "info", + "@message": "tfcoremock_set.set: Destroying... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_set.set", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_set.set", + "resource_key": null, + "resource_name": "set", + "resource_type": "tfcoremock_set" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_set.set: Destruction complete after 0s", + "@module": "terraform.ui", + "hook": { + "action": "delete", + "elapsed_seconds": 0, + "resource": { + "addr": "tfcoremock_set.set", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_set.set", + "resource_key": null, + "resource_name": "set", + "resource_type": "tfcoremock_set" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "tfcoremock_set.set: Creating...", + "@module": "terraform.ui", + "hook": { + "action": "create", + "resource": { + "addr": "tfcoremock_set.set", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_set.set", + "resource_key": null, + "resource_name": "set", + "resource_type": "tfcoremock_set" + } + }, + "type": "apply_start" + }, + { + "@level": "info", + "@message": "tfcoremock_set.set: Creation complete after 0s [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415]", + "@module": "terraform.ui", + "hook": { + "action": "create", + "elapsed_seconds": 0, + "id_key": "id", + "id_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "resource": { + "addr": "tfcoremock_set.set", + "implied_provider": "tfcoremock", + "module": "", + "resource": "tfcoremock_set.set", + "resource_key": null, + "resource_name": "set", + "resource_type": "tfcoremock_set" + } + }, + "type": "apply_complete" + }, + { + "@level": "info", + "@message": "Apply complete! Resources: 1 added, 0 changed, 1 destroyed.", + "@module": "terraform.ui", + "changes": { + "add": 1, + "change": 0, + "operation": "apply", + "remove": 1 + }, + "type": "change_summary" + }, + { + "@level": "info", + "@message": "Outputs: 0", + "@module": "terraform.ui", + "outputs": {}, + "type": "outputs" + } +] \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_set/plan b/testing/equivalence-tests/outputs/replace_within_set/plan new file mode 100644 index 000000000000..4c1a274e03e0 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_set/plan @@ -0,0 +1,30 @@ +tfcoremock_set.set: Refreshing state... [id=F40F2AB4-100C-4AE8-BFD0-BF332A158415] + +Terraform used the selected providers to generate the following execution +plan. Resource actions are indicated with the following symbols: +-/+ destroy and then create replacement + +Terraform will perform the following actions: + + # tfcoremock_set.set must be replaced +-/+ resource "tfcoremock_set" "set" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + ~ set = [ + + { # forces replacement + + id = "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + - { # forces replacement + - id = "56C7E07F-B9DF-4799-AF62-E703D1167A51" -> null + }, + # (2 unchanged elements hidden) + ] + } + +Plan: 1 to add, 0 to change, 1 to destroy. + +───────────────────────────────────────────────────────────────────────────── + +Saved the plan to: equivalence_test_plan + +To perform exactly these actions, run the following command to apply: + terraform apply "equivalence_test_plan" diff --git a/testing/equivalence-tests/outputs/replace_within_set/plan.json b/testing/equivalence-tests/outputs/replace_within_set/plan.json new file mode 100644 index 000000000000..26f8794eaf17 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_set/plan.json @@ -0,0 +1,179 @@ +{ + "configuration": { + "provider_config": { + "tfcoremock": { + "full_name": "registry.terraform.io/hashicorp/tfcoremock", + "name": "tfcoremock", + "version_constraint": "0.1.1" + } + }, + "root_module": { + "resources": [ + { + "address": "tfcoremock_set.set", + "expressions": { + "id": { + "constant_value": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "set": { + "constant_value": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + }, + "mode": "managed", + "name": "set", + "provider_config_key": "tfcoremock", + "schema_version": 0, + "type": "tfcoremock_set" + } + ] + } + }, + "format_version": "1.1", + "planned_values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_set.set", + "mode": "managed", + "name": "set", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "set": [ + {}, + {}, + {} + ] + }, + "type": "tfcoremock_set", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "set": [ + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + } + ] + } + }, + "prior_state": { + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_set.set", + "mode": "managed", + "name": "set", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "set": [ + {}, + {}, + {} + ] + }, + "type": "tfcoremock_set", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "set": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + ] + } + } + ] + } + } + }, + "resource_changes": [ + { + "action_reason": "replace_because_cannot_update", + "address": "tfcoremock_set.set", + "change": { + "actions": [ + "delete", + "create" + ], + "after": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "set": [ + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + }, + "after_sensitive": { + "set": [ + {}, + {}, + {} + ] + }, + "after_unknown": {}, + "before": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "set": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + ] + }, + "before_sensitive": { + "set": [ + {}, + {}, + {} + ] + }, + "replace_paths": [ + [ + "set" + ] + ] + }, + "mode": "managed", + "name": "set", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "type": "tfcoremock_set" + } + ] +} \ No newline at end of file diff --git a/testing/equivalence-tests/outputs/replace_within_set/state.json b/testing/equivalence-tests/outputs/replace_within_set/state.json new file mode 100644 index 000000000000..992019e97d77 --- /dev/null +++ b/testing/equivalence-tests/outputs/replace_within_set/state.json @@ -0,0 +1,38 @@ +{ + "format_version": "1.0", + "values": { + "root_module": { + "resources": [ + { + "address": "tfcoremock_set.set", + "mode": "managed", + "name": "set", + "provider_name": "registry.terraform.io/hashicorp/tfcoremock", + "schema_version": 0, + "sensitive_values": { + "set": [ + {}, + {}, + {} + ] + }, + "type": "tfcoremock_set", + "values": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "set": [ + { + "id": "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/basic_json_string_update/.terraform.lock.hcl b/testing/equivalence-tests/tests/basic_json_string_update/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_json_string_update/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/basic_json_string_update/main.tf b/testing/equivalence-tests/tests/basic_json_string_update/main.tf new file mode 100644 index 000000000000..37e3cadacb01 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_json_string_update/main.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "json" { + string = "{\"list-attribute\":[\"one\",\"four\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_three\":\"value_two\", \"key_four\":\"value_three\"},\"string-attribute\":\"a new string\"}" +} diff --git a/testing/equivalence-tests/tests/basic_json_string_update/spec.json b/testing/equivalence-tests/tests/basic_json_string_update/spec.json new file mode 100644 index 000000000000..ef42c1a35eda --- /dev/null +++ b/testing/equivalence-tests/tests/basic_json_string_update/spec.json @@ -0,0 +1,5 @@ +{ + "description": "tests updating a JSON compatible string", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/basic_json_string_update/terraform.resource/5a3fd9b3-e852-8956-8c0a-255d47eda645.json b/testing/equivalence-tests/tests/basic_json_string_update/terraform.resource/5a3fd9b3-e852-8956-8c0a-255d47eda645.json new file mode 100644 index 000000000000..5604f6c2f207 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_json_string_update/terraform.resource/5a3fd9b3-e852-8956-8c0a-255d47eda645.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "5a3fd9b3-e852-8956-8c0a-255d47eda645" + }, + "string": { + "string": "{\"list-attribute\":[\"one\",\"two\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_two\":\"value_two\",\"key_three\":\"value_three\"},\"string-attribute\":\"string\"}" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/basic_json_string_update/terraform.tfstate b/testing/equivalence-tests/tests/basic_json_string_update/terraform.tfstate new file mode 100644 index 000000000000..24089bcfdef1 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_json_string_update/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "4a3a27e3-e5b3-3db6-bc4c-6b762a030232", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "json", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "5a3fd9b3-e852-8956-8c0a-255d47eda645", + "integer": null, + "number": null, + "string": "{\"list-attribute\":[\"one\",\"two\",\"three\"],\"object-attribute\":{\"key_one\":\"value_one\",\"key_two\":\"value_two\",\"key_three\":\"value_three\"},\"string-attribute\":\"string\"}" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/basic_list/spec.json b/testing/equivalence-tests/tests/basic_list/spec.json index a3f0a709b918..1a085f69cf61 100644 --- a/testing/equivalence-tests/tests/basic_list/spec.json +++ b/testing/equivalence-tests/tests/basic_list/spec.json @@ -1,4 +1,5 @@ { + "description": "basic test covering creation of a single list", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_list_empty/spec.json b/testing/equivalence-tests/tests/basic_list_empty/spec.json index a3f0a709b918..99bfdb40d6a2 100644 --- a/testing/equivalence-tests/tests/basic_list_empty/spec.json +++ b/testing/equivalence-tests/tests/basic_list_empty/spec.json @@ -1,4 +1,5 @@ { + "description": "tests removing all elements from a simple list", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_list_null/spec.json b/testing/equivalence-tests/tests/basic_list_null/spec.json index a3f0a709b918..779888c48f25 100644 --- a/testing/equivalence-tests/tests/basic_list_null/spec.json +++ b/testing/equivalence-tests/tests/basic_list_null/spec.json @@ -1,4 +1,5 @@ { + "description": "tests deleting a simple list from a resource", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_list_update/spec.json b/testing/equivalence-tests/tests/basic_list_update/spec.json index a3f0a709b918..bf5bca6265cb 100644 --- a/testing/equivalence-tests/tests/basic_list_update/spec.json +++ b/testing/equivalence-tests/tests/basic_list_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests adding and removing elements from a simple list", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_map/spec.json b/testing/equivalence-tests/tests/basic_map/spec.json index a3f0a709b918..91eeb9ea4daf 100644 --- a/testing/equivalence-tests/tests/basic_map/spec.json +++ b/testing/equivalence-tests/tests/basic_map/spec.json @@ -1,4 +1,5 @@ { + "description": "basic test covering creation of a simple map", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_map_empty/spec.json b/testing/equivalence-tests/tests/basic_map_empty/spec.json index a3f0a709b918..678b5cddf62d 100644 --- a/testing/equivalence-tests/tests/basic_map_empty/spec.json +++ b/testing/equivalence-tests/tests/basic_map_empty/spec.json @@ -1,4 +1,5 @@ { + "description": "tests removing all elements from a simple map", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_map_null/spec.json b/testing/equivalence-tests/tests/basic_map_null/spec.json index a3f0a709b918..3eb24d9855d4 100644 --- a/testing/equivalence-tests/tests/basic_map_null/spec.json +++ b/testing/equivalence-tests/tests/basic_map_null/spec.json @@ -1,4 +1,5 @@ { + "description": "tests deleting a simple map from a resource", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_map_update/spec.json b/testing/equivalence-tests/tests/basic_map_update/spec.json index a3f0a709b918..332a515865c5 100644 --- a/testing/equivalence-tests/tests/basic_map_update/spec.json +++ b/testing/equivalence-tests/tests/basic_map_update/spec.json @@ -1,4 +1,5 @@ { + "description": "basic test coverting updating a simple map", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_multiline_string_update/.terraform.lock.hcl b/testing/equivalence-tests/tests/basic_multiline_string_update/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_multiline_string_update/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/basic_multiline_string_update/main.tf b/testing/equivalence-tests/tests/basic_multiline_string_update/main.tf new file mode 100644 index 000000000000..c3bbaaa8bfb6 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_multiline_string_update/main.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "multiline" { + string = "one\nthree\ntwo\nfour\nsix\nseven" +} diff --git a/testing/equivalence-tests/tests/basic_multiline_string_update/spec.json b/testing/equivalence-tests/tests/basic_multiline_string_update/spec.json new file mode 100644 index 000000000000..16347a0d9269 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_multiline_string_update/spec.json @@ -0,0 +1,5 @@ +{ + "description": "tests handling of multiline strings when updating", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/basic_multiline_string_update/terraform.resource/69fe5233-e77a-804f-0dac-115c949540bc.json b/testing/equivalence-tests/tests/basic_multiline_string_update/terraform.resource/69fe5233-e77a-804f-0dac-115c949540bc.json new file mode 100644 index 000000000000..8ad35d41d684 --- /dev/null +++ b/testing/equivalence-tests/tests/basic_multiline_string_update/terraform.resource/69fe5233-e77a-804f-0dac-115c949540bc.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "69fe5233-e77a-804f-0dac-115c949540bc" + }, + "string": { + "string": "one\ntwo\nthree\nfour\nfive" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/basic_multiline_string_update/terraform.tfstate b/testing/equivalence-tests/tests/basic_multiline_string_update/terraform.tfstate new file mode 100644 index 000000000000..050b25962f6a --- /dev/null +++ b/testing/equivalence-tests/tests/basic_multiline_string_update/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "1e8cb645-9856-bc39-5053-f58ec18be73d", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "multiline", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "69fe5233-e77a-804f-0dac-115c949540bc", + "integer": null, + "number": null, + "string": "one\ntwo\nthree\nfour\nfive" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/basic_set/spec.json b/testing/equivalence-tests/tests/basic_set/spec.json index a3f0a709b918..5ac9530a8073 100644 --- a/testing/equivalence-tests/tests/basic_set/spec.json +++ b/testing/equivalence-tests/tests/basic_set/spec.json @@ -1,4 +1,5 @@ { + "description": "basic test coverting creation of a simple set", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_set_empty/spec.json b/testing/equivalence-tests/tests/basic_set_empty/spec.json index a3f0a709b918..ed8691da37fa 100644 --- a/testing/equivalence-tests/tests/basic_set_empty/spec.json +++ b/testing/equivalence-tests/tests/basic_set_empty/spec.json @@ -1,4 +1,5 @@ { + "description": "tests removing all elements from a simple set", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_set_null/spec.json b/testing/equivalence-tests/tests/basic_set_null/spec.json index a3f0a709b918..07aa574b6cea 100644 --- a/testing/equivalence-tests/tests/basic_set_null/spec.json +++ b/testing/equivalence-tests/tests/basic_set_null/spec.json @@ -1,4 +1,5 @@ { + "description": "tests deleting a simple set", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/basic_set_update/spec.json b/testing/equivalence-tests/tests/basic_set_update/spec.json index a3f0a709b918..7df5cf3da0a0 100644 --- a/testing/equivalence-tests/tests/basic_set_update/spec.json +++ b/testing/equivalence-tests/tests/basic_set_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests adding and removing elements from a simple set", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/data_read/create/main.tf b/testing/equivalence-tests/tests/data_read/create/main.tf new file mode 100644 index 000000000000..5cb4ba343e5c --- /dev/null +++ b/testing/equivalence-tests/tests/data_read/create/main.tf @@ -0,0 +1,32 @@ + +variable "contents" { + type = string +} + +resource "random_integer" "random" { + min = 1000000 + max = 9999999 + seed = "F78CB410-BA01-44E1-82E1-37D61F7CB158" +} + +locals { + contents = jsonencode({ + values = { + id = { + string = random_integer.random.id + } + string = { + string = var.contents + } + } + }) +} + +resource "local_file" "data_file" { + filename = "terraform.data/${random_integer.random.id}.json" + content = local.contents +} + +output "id" { + value = random_integer.random.id +} diff --git a/testing/equivalence-tests/tests/data_read/main.tf b/testing/equivalence-tests/tests/data_read/main.tf new file mode 100644 index 000000000000..67c3f11a658a --- /dev/null +++ b/testing/equivalence-tests/tests/data_read/main.tf @@ -0,0 +1,39 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + local = { + source = "hashicorp/local" + version = "2.2.3" + } + random = { + source = "hashicorp/random" + version = "3.4.3" + } + } +} + +provider "tfcoremock" {} + +provider "local" {} + +provider "random" {} + +module "create" { + source = "./create" + contents = "hello, world!" +} + +data "tfcoremock_simple_resource" "read" { + id = module.create.id + + depends_on = [ + module.create + ] +} + +resource "tfcoremock_simple_resource" "create" { + string = data.tfcoremock_simple_resource.read.string +} diff --git a/testing/equivalence-tests/tests/data_read/spec.json b/testing/equivalence-tests/tests/data_read/spec.json new file mode 100644 index 000000000000..7931b8ce19a5 --- /dev/null +++ b/testing/equivalence-tests/tests/data_read/spec.json @@ -0,0 +1,27 @@ +{ + "description": "tests reading data from data sources using only a plan", + "include_files": [], + "ignore_fields": {}, + "commands": [ + { + "name": "init", + "arguments": ["init"], + "capture_output": false + }, + { + "name": "plan", + "arguments": ["plan", "-out=equivalence_test_plan", "-no-color"], + "capture_output": true, + "output_file_name": "plan", + "has_json_output": false + }, + { + "name": "show_plan", + "arguments": ["show", "-json", "equivalence_test_plan"], + "capture_output": true, + "output_file_name": "plan.json", + "has_json_output": true, + "streams_json_output": false + } + ] +} diff --git a/testing/equivalence-tests/tests/drift_refresh_only/.terraform.lock.hcl b/testing/equivalence-tests/tests/drift_refresh_only/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_refresh_only/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/drift_refresh_only/main.tf b/testing/equivalence-tests/tests/drift_refresh_only/main.tf new file mode 100644 index 000000000000..77e891392b30 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_refresh_only/main.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "drift" { + string = "Hello, world!" +} diff --git a/testing/equivalence-tests/tests/drift_refresh_only/spec.json b/testing/equivalence-tests/tests/drift_refresh_only/spec.json new file mode 100644 index 000000000000..810211a4cb5c --- /dev/null +++ b/testing/equivalence-tests/tests/drift_refresh_only/spec.json @@ -0,0 +1,43 @@ +{ + "description": "tests drift in a refresh only plan, so has a custom set of commands", + "include_files": [], + "ignore_fields": {}, + "commands": [ + { + "name": "init", + "arguments": ["init"], + "capture_output": false + }, + { + "name": "plan", + "arguments": ["plan", "-out=equivalence_test_plan", "-no-color", "-refresh-only"], + "capture_output": true, + "output_file_name": "plan", + "has_json_output": false + }, + { + "name": "apply", + "arguments": ["apply", "-json", "equivalence_test_plan"], + "capture_output": true, + "output_file_name": "apply.json", + "has_json_output": true, + "streams_json_output": true + }, + { + "name": "show_state", + "arguments": ["show", "-json"], + "capture_output": true, + "output_file_name": "state.json", + "has_json_output": true, + "streams_json_output": false + }, + { + "name": "show_plan", + "arguments": ["show", "-json", "equivalence_test_plan"], + "capture_output": true, + "output_file_name": "plan.json", + "has_json_output": true, + "streams_json_output": false + } + ] +} diff --git a/testing/equivalence-tests/tests/drift_refresh_only/terraform.resource/cb79269e-dc39-1e68-0a9c-63cb392afda9.json b/testing/equivalence-tests/tests/drift_refresh_only/terraform.resource/cb79269e-dc39-1e68-0a9c-63cb392afda9.json new file mode 100644 index 000000000000..4446f2c11f4d --- /dev/null +++ b/testing/equivalence-tests/tests/drift_refresh_only/terraform.resource/cb79269e-dc39-1e68-0a9c-63cb392afda9.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "cb79269e-dc39-1e68-0a9c-63cb392afda9" + }, + "string": { + "string": "Hello, drift!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/drift_refresh_only/terraform.tfstate b/testing/equivalence-tests/tests/drift_refresh_only/terraform.tfstate new file mode 100644 index 000000000000..b0ae38799332 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_refresh_only/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "4ce8adfd-57a0-aba7-118d-834394462086", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "drift", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "cb79269e-dc39-1e68-0a9c-63cb392afda9", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/drift_relevant_attributes/.terraform.lock.hcl b/testing/equivalence-tests/tests/drift_relevant_attributes/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_relevant_attributes/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/drift_relevant_attributes/main.tf b/testing/equivalence-tests/tests/drift_relevant_attributes/main.tf new file mode 100644 index 000000000000..a73a09797d5c --- /dev/null +++ b/testing/equivalence-tests/tests/drift_relevant_attributes/main.tf @@ -0,0 +1,19 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "base" { + string = "Hello, change!" + number = 0 +} + +resource "tfcoremock_simple_resource" "dependent" { + string = tfcoremock_simple_resource.base.string +} diff --git a/testing/equivalence-tests/tests/drift_relevant_attributes/spec.json b/testing/equivalence-tests/tests/drift_relevant_attributes/spec.json new file mode 100644 index 000000000000..273ef1b49d45 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_relevant_attributes/spec.json @@ -0,0 +1,5 @@ +{ + "description": "tests that relevant attributes are applied when dependent resources are updated by drift", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/1b17b502-96c9-fcc3-3b09-2af1c3de6ad8.json b/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/1b17b502-96c9-fcc3-3b09-2af1c3de6ad8.json new file mode 100644 index 000000000000..cd2b86e8561b --- /dev/null +++ b/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/1b17b502-96c9-fcc3-3b09-2af1c3de6ad8.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8" + }, + "string": { + "string": "Hello, world!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/f6f74ca6-e8ef-e51f-522c-433b9ed5038f.json b/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/f6f74ca6-e8ef-e51f-522c-433b9ed5038f.json new file mode 100644 index 000000000000..32b5d247e535 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.resource/f6f74ca6-e8ef-e51f-522c-433b9ed5038f.json @@ -0,0 +1,13 @@ +{ + "values": { + "id": { + "string": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f" + }, + "number": { + "number": "0" + }, + "string": { + "string": "Hello, drift!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.tfstate b/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.tfstate new file mode 100644 index 000000000000..9ad07bf00ff0 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_relevant_attributes/terraform.tfstate @@ -0,0 +1,53 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 5, + "lineage": "f521f089-8673-e4a9-93a7-4f01f72fbc15", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "base", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "f6f74ca6-e8ef-e51f-522c-433b9ed5038f", + "integer": null, + "number": 0, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "dependent", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "1b17b502-96c9-fcc3-3b09-2af1c3de6ad8", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [], + "dependencies": [ + "tfcoremock_simple_resource.base" + ] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/drift_simple/.terraform.lock.hcl b/testing/equivalence-tests/tests/drift_simple/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_simple/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/drift_simple/main.tf b/testing/equivalence-tests/tests/drift_simple/main.tf new file mode 100644 index 000000000000..77e891392b30 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_simple/main.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "drift" { + string = "Hello, world!" +} diff --git a/testing/equivalence-tests/tests/drift_simple/spec.json b/testing/equivalence-tests/tests/drift_simple/spec.json new file mode 100644 index 000000000000..71d921b3b8b5 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_simple/spec.json @@ -0,0 +1,5 @@ +{ + "description": "a simple test that models drift in a single resource by updating an existing resource outside of Terraform", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/drift_simple/terraform.resource/f3c6ddc5-37d5-0170-64ff-518ad421385a.json b/testing/equivalence-tests/tests/drift_simple/terraform.resource/f3c6ddc5-37d5-0170-64ff-518ad421385a.json new file mode 100644 index 000000000000..14976bf5aa9a --- /dev/null +++ b/testing/equivalence-tests/tests/drift_simple/terraform.resource/f3c6ddc5-37d5-0170-64ff-518ad421385a.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "f3c6ddc5-37d5-0170-64ff-518ad421385a" + }, + "string": { + "string": "Hello, drift!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/drift_simple/terraform.tfstate b/testing/equivalence-tests/tests/drift_simple/terraform.tfstate new file mode 100644 index 000000000000..2d652ab56590 --- /dev/null +++ b/testing/equivalence-tests/tests/drift_simple/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "3ee5327f-66cc-dd24-f2f1-95ef63c0bcb8", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "drift", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "f3c6ddc5-37d5-0170-64ff-518ad421385a", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/fully_populated_complex/main.tf b/testing/equivalence-tests/tests/fully_populated_complex/main.tf new file mode 100644 index 000000000000..64335c742e75 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex/main.tf @@ -0,0 +1,209 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_complex_resource" "complex" { + id = "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + + number = 123456789.0 + integer = 987654321 + float = 987654321.0 + + string = "a not very long or complex string" + + bool = true + + list = [ + { + string = "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + string = "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + ] + + object = { + string = "i am a nested object" + + number = 0 + bool = false + + object = { + string = "i am a nested nested object" + number = 1 + bool = true + } + } + + map = { + "key_one" = { + string = "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_two" = { + string = "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + }, + "key_three" = { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + "key_four" = { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + } + + set = [ + { + string = "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + string = "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + }, + { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + ] + + list_block { + string = "{\"index\":0}" + } + + list_block { + string = "{\"index\":1}" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + } + + list_block { + string = "{\"index\":2}" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + + set_block { + string = "{\"index\":0}" + } + + set_block { + string = "{\"index\":1}" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + } + + set_block { + string = "{\"index\":2}" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/fully_populated_complex/spec.json b/testing/equivalence-tests/tests/fully_populated_complex/spec.json new file mode 100644 index 000000000000..8fc0b7b188a5 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex/spec.json @@ -0,0 +1,6 @@ +{ + "description": "this test creates an almost fully populated tfcoremock_complex_resource, which should cover most basic Terraform use cases", + "include_files": [], + "ignore_fields": {} +} + diff --git a/testing/equivalence-tests/tests/fully_populated_complex_destroy/.terraform.lock.hcl b/testing/equivalence-tests/tests/fully_populated_complex_destroy/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_destroy/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/fully_populated_complex_destroy/main.tf b/testing/equivalence-tests/tests/fully_populated_complex_destroy/main.tf new file mode 100644 index 000000000000..f5b590fde222 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_destroy/main.tf @@ -0,0 +1,206 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_complex_resource" "complex" { + id = "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + + number = 987654321.0 + integer = 123456789 + float = 123456789.0 + + string = "a not very long or complex string" + + bool = true + + list = [ + { + string = "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + string = "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 3 + }, + { + number = 4 + } + ] + }, + { + string = "this is my fourth entry, and I actually have a nested set and I edited my test" + + set = [ + { + number = 0 + }, + { + number = 2 + }, + ] + } + ] + + object = { + string = "i am a nested object" + + number = 0 + + object = { + string = "i am a nested nested object" + bool = true + } + } + + map = { + "key_one" = { + string = "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_two" = { + string = "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + }, + "key_three" = { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 3 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + "key_four" = { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 3 + }, + { + number = 4 + }, + ] + } + } + + set = [ + { + string = "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + string = "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + }, + { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + ] + + list_block { + string = "{\"index\":0}" + } + + list_block { + string = "{\"index\":1}" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + } + + set_block { + string = "{\"index\":1}" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + } + + set_block { + string = "{\"index\":2}" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + + set_block { + string = "{\"index\":3}" + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/fully_populated_complex_destroy/spec.json b/testing/equivalence-tests/tests/fully_populated_complex_destroy/spec.json new file mode 100644 index 000000000000..e91bd2cd06a0 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_destroy/spec.json @@ -0,0 +1,42 @@ +{ + "include_files": [], + "ignore_fields": {}, + "commands": [ + { + "name": "init", + "arguments": ["init"], + "capture_output": false + }, + { + "name": "plan", + "arguments": ["plan", "-out=equivalence_test_plan", "-no-color", "-destroy"], + "capture_output": true, + "output_file_name": "plan", + "has_json_output": false + }, + { + "name": "apply", + "arguments": ["destroy", "-json", "-auto-approve"], + "capture_output": true, + "output_file_name": "apply.json", + "has_json_output": true, + "streams_json_output": true + }, + { + "name": "show_state", + "arguments": ["show", "-json"], + "capture_output": true, + "output_file_name": "state.json", + "has_json_output": true, + "streams_json_output": false + }, + { + "name": "show_plan", + "arguments": ["show", "-json", "equivalence_test_plan"], + "capture_output": true, + "output_file_name": "plan.json", + "has_json_output": true, + "streams_json_output": false + } + ] +} diff --git a/testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json b/testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json new file mode 100644 index 000000000000..49aa8d9c66f1 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json @@ -0,0 +1,445 @@ +{ + "values": { + "bool": { + "boolean": true + }, + "float": { + "number": "9.87654321e+08" + }, + "id": { + "string": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + }, + "integer": { + "number": "9.87654321e+08" + }, + "list": { + "list": [ + { + "object": { + "string": { + "string": "this is my first entry in the list, and doesn't contain anything interesting" + } + } + }, + { + "object": { + "string": { + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + } + } + }, + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "string": { + "string": "this is my third entry, and I actually have a nested list" + } + } + }, + { + "object": { + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "string": { + "string": "this is my fourth entry, and I actually have a nested set" + } + } + } + ] + }, + "list_block": { + "list": [ + { + "object": { + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":0}" + } + } + }, + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":1}" + } + } + }, + { + "object": { + "list_block": { + "list": [] + }, + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":2}" + } + } + } + ] + }, + "map": { + "map": { + "key_four": { + "object": { + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "string": { + "string": "this is my fourth entry, and I actually have a nested set" + } + } + }, + "key_one": { + "object": { + "string": { + "string": "this is my first entry in the map, and doesn't contain anything interesting" + } + } + }, + "key_three": { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "string": { + "string": "this is my third entry, and I actually have a nested list" + } + } + }, + "key_two": { + "object": { + "string": { + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + } + } + } + }, + "number": { + "number": "1.23456789e+08" + }, + "object": { + "object": { + "bool": { + "boolean": false + }, + "number": { + "number": "0" + }, + "object": { + "object": { + "bool": { + "boolean": true + }, + "number": { + "number": "1" + }, + "string": { + "string": "i am a nested nested object" + } + } + }, + "string": { + "string": "i am a nested object" + } + } + }, + "set": { + "set": [ + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "string": { + "string": "this is my third entry, and I actually have a nested list" + } + } + }, + { + "object": { + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "string": { + "string": "this is my fourth entry, and I actually have a nested set" + } + } + }, + { + "object": { + "string": { + "string": "this is my first entry in the set, and doesn't contain anything interesting" + } + } + }, + { + "object": { + "string": { + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + } + } + ] + }, + "set_block": { + "set": [ + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":1}" + } + } + }, + { + "object": { + "list_block": { + "list": [] + }, + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":2}" + } + } + }, + { + "object": { + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":0}" + } + } + } + ] + }, + "string": { + "string": "a not very long or complex string" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.tfstate b/testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.tfstate new file mode 100644 index 000000000000..6945ad2d9929 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_destroy/terraform.tfstate @@ -0,0 +1,556 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "bc319b50-c252-a9b5-3ce3-3128618500d6", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_complex_resource", + "name": "complex", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/fully_populated_complex_update/.terraform.lock.hcl b/testing/equivalence-tests/tests/fully_populated_complex_update/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_update/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/fully_populated_complex_update/main.tf b/testing/equivalence-tests/tests/fully_populated_complex_update/main.tf new file mode 100644 index 000000000000..f5b590fde222 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_update/main.tf @@ -0,0 +1,206 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_complex_resource" "complex" { + id = "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + + number = 987654321.0 + integer = 123456789 + float = 123456789.0 + + string = "a not very long or complex string" + + bool = true + + list = [ + { + string = "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + string = "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines\nbut I've been edited" + }, + { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 3 + }, + { + number = 4 + } + ] + }, + { + string = "this is my fourth entry, and I actually have a nested set and I edited my test" + + set = [ + { + number = 0 + }, + { + number = 2 + }, + ] + } + ] + + object = { + string = "i am a nested object" + + number = 0 + + object = { + string = "i am a nested nested object" + bool = true + } + } + + map = { + "key_one" = { + string = "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_two" = { + string = "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + }, + "key_three" = { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 3 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + "key_four" = { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 3 + }, + { + number = 4 + }, + ] + } + } + + set = [ + { + string = "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + string = "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + }, + { + string = "this is my third entry, and I actually have a nested list" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + }, + { + string = "this is my fourth entry, and I actually have a nested set" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + ] + + list_block { + string = "{\"index\":0}" + } + + list_block { + string = "{\"index\":1}" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + } + + set_block { + string = "{\"index\":1}" + + list = [ + { + number = 0 + }, + { + number = 1 + }, + { + number = 2 + } + ] + } + + set_block { + string = "{\"index\":2}" + + set = [ + { + number = 0 + }, + { + number = 1 + }, + ] + } + + set_block { + string = "{\"index\":3}" + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/fully_populated_complex_update/spec.json b/testing/equivalence-tests/tests/fully_populated_complex_update/spec.json new file mode 100644 index 000000000000..cc62355313e3 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_update/spec.json @@ -0,0 +1,5 @@ +{ + "include_files": [], + "ignore_fields": {} +} + diff --git a/testing/equivalence-tests/tests/fully_populated_complex_update/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json b/testing/equivalence-tests/tests/fully_populated_complex_update/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json new file mode 100644 index 000000000000..49aa8d9c66f1 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_update/terraform.resource/64564E36-BFCB-458B-9405-EBBF6A3CAC7A.json @@ -0,0 +1,445 @@ +{ + "values": { + "bool": { + "boolean": true + }, + "float": { + "number": "9.87654321e+08" + }, + "id": { + "string": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A" + }, + "integer": { + "number": "9.87654321e+08" + }, + "list": { + "list": [ + { + "object": { + "string": { + "string": "this is my first entry in the list, and doesn't contain anything interesting" + } + } + }, + { + "object": { + "string": { + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + } + } + }, + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "string": { + "string": "this is my third entry, and I actually have a nested list" + } + } + }, + { + "object": { + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "string": { + "string": "this is my fourth entry, and I actually have a nested set" + } + } + } + ] + }, + "list_block": { + "list": [ + { + "object": { + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":0}" + } + } + }, + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":1}" + } + } + }, + { + "object": { + "list_block": { + "list": [] + }, + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":2}" + } + } + } + ] + }, + "map": { + "map": { + "key_four": { + "object": { + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "string": { + "string": "this is my fourth entry, and I actually have a nested set" + } + } + }, + "key_one": { + "object": { + "string": { + "string": "this is my first entry in the map, and doesn't contain anything interesting" + } + } + }, + "key_three": { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "string": { + "string": "this is my third entry, and I actually have a nested list" + } + } + }, + "key_two": { + "object": { + "string": { + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + } + } + } + }, + "number": { + "number": "1.23456789e+08" + }, + "object": { + "object": { + "bool": { + "boolean": false + }, + "number": { + "number": "0" + }, + "object": { + "object": { + "bool": { + "boolean": true + }, + "number": { + "number": "1" + }, + "string": { + "string": "i am a nested nested object" + } + } + }, + "string": { + "string": "i am a nested object" + } + } + }, + "set": { + "set": [ + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "string": { + "string": "this is my third entry, and I actually have a nested list" + } + } + }, + { + "object": { + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "string": { + "string": "this is my fourth entry, and I actually have a nested set" + } + } + }, + { + "object": { + "string": { + "string": "this is my first entry in the set, and doesn't contain anything interesting" + } + } + }, + { + "object": { + "string": { + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + } + } + ] + }, + "set_block": { + "set": [ + { + "object": { + "list": { + "list": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + }, + { + "object": { + "number": { + "number": "2" + } + } + } + ] + }, + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":1}" + } + } + }, + { + "object": { + "list_block": { + "list": [] + }, + "set": { + "set": [ + { + "object": { + "number": { + "number": "0" + } + } + }, + { + "object": { + "number": { + "number": "1" + } + } + } + ] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":2}" + } + } + }, + { + "object": { + "list_block": { + "list": [] + }, + "set_block": { + "set": [] + }, + "string": { + "string": "{\"index\":0}" + } + } + } + ] + }, + "string": { + "string": "a not very long or complex string" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/fully_populated_complex_update/terraform.tfstate b/testing/equivalence-tests/tests/fully_populated_complex_update/terraform.tfstate new file mode 100644 index 000000000000..6945ad2d9929 --- /dev/null +++ b/testing/equivalence-tests/tests/fully_populated_complex_update/terraform.tfstate @@ -0,0 +1,556 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "bc319b50-c252-a9b5-3ce3-3128618500d6", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_complex_resource", + "name": "complex", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": true, + "float": 987654321, + "id": "64564E36-BFCB-458B-9405-EBBF6A3CAC7A", + "integer": 987654321, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the list, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the list\nI am a bit more interesting\nand contain multiple lines" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + } + ], + "list_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + } + ], + "map": { + "key_four": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + "key_one": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the map, and doesn't contain anything interesting" + }, + "key_three": { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + "key_two": { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the map\nI am a bit more interesting\nand contain multiple lines" + } + }, + "number": 123456789, + "object": { + "bool": false, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": { + "bool": true, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": "i am a nested nested object" + }, + "set": null, + "string": "i am a nested object" + }, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my third entry, and I actually have a nested list" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "string": "this is my fourth entry, and I actually have a nested set" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my first entry in the set, and doesn't contain anything interesting" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": null, + "object": null, + "set": null, + "string": "this is my second entry in the set\nI am a bit more interesting\nand contain multiple lines" + } + ], + "set_block": [ + { + "bool": null, + "float": null, + "integer": null, + "list": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 2, + "object": null, + "set": null, + "string": null + } + ], + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":1}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": [ + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 0, + "object": null, + "set": null, + "string": null + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "map": null, + "number": 1, + "object": null, + "set": null, + "string": null + } + ], + "set_block": [], + "string": "{\"index\":2}" + }, + { + "bool": null, + "float": null, + "integer": null, + "list": null, + "list_block": [], + "map": null, + "number": null, + "object": null, + "set": null, + "set_block": [], + "string": "{\"index\":0}" + } + ], + "string": "a not very long or complex string" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/local_provider_basic/spec.json b/testing/equivalence-tests/tests/local_provider_basic/spec.json index 91a8f89193c3..e47d6d23ee33 100644 --- a/testing/equivalence-tests/tests/local_provider_basic/spec.json +++ b/testing/equivalence-tests/tests/local_provider_basic/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating a local file using the local provider", "include_files": [ "output.json" ], diff --git a/testing/equivalence-tests/tests/local_provider_delete/spec.json b/testing/equivalence-tests/tests/local_provider_delete/spec.json index a3f0a709b918..e3a25780ec8e 100644 --- a/testing/equivalence-tests/tests/local_provider_delete/spec.json +++ b/testing/equivalence-tests/tests/local_provider_delete/spec.json @@ -1,4 +1,5 @@ { + "description": "test deleting a file created by the local provider", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/local_provider_update/spec.json b/testing/equivalence-tests/tests/local_provider_update/spec.json index 91a8f89193c3..17b0f32774bf 100644 --- a/testing/equivalence-tests/tests/local_provider_update/spec.json +++ b/testing/equivalence-tests/tests/local_provider_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating a file using the local provider", "include_files": [ "output.json" ], diff --git a/testing/equivalence-tests/tests/moved_simple/.terraform.lock.hcl b/testing/equivalence-tests/tests/moved_simple/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_simple/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/moved_simple/main.tf b/testing/equivalence-tests/tests/moved_simple/main.tf new file mode 100644 index 000000000000..356b980f9b22 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_simple/main.tf @@ -0,0 +1,20 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + + +resource "tfcoremock_simple_resource" "second" { + string = "Hello, world!" +} + +moved { + from = tfcoremock_simple_resource.first + to = tfcoremock_simple_resource.second +} diff --git a/testing/equivalence-tests/tests/moved_simple/spec.json b/testing/equivalence-tests/tests/moved_simple/spec.json new file mode 100644 index 000000000000..d9c1fbd05b9d --- /dev/null +++ b/testing/equivalence-tests/tests/moved_simple/spec.json @@ -0,0 +1,5 @@ +{ + "description": "tests an unchanged resource being moved", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/moved_simple/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json b/testing/equivalence-tests/tests/moved_simple/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json new file mode 100644 index 000000000000..6c63be352de7 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_simple/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "70c47571-66c3-b1dc-2474-47a74b9c7886" + }, + "string": { + "string": "Hello, world!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/moved_simple/terraform.tfstate b/testing/equivalence-tests/tests/moved_simple/terraform.tfstate new file mode 100644 index 000000000000..89f82ba7123a --- /dev/null +++ b/testing/equivalence-tests/tests/moved_simple/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "4a0f03a7-03fd-9357-9fd2-b3405139fa1d", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "first", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/moved_with_drift/.terraform.lock.hcl b/testing/equivalence-tests/tests/moved_with_drift/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_drift/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/moved_with_drift/main.tf b/testing/equivalence-tests/tests/moved_with_drift/main.tf new file mode 100644 index 000000000000..e060e2bbd0f5 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_drift/main.tf @@ -0,0 +1,23 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "base_after" { + string = "Hello, change!" +} + +resource "tfcoremock_simple_resource" "dependent" { + string = tfcoremock_simple_resource.base_after.string +} + +moved { + from = tfcoremock_simple_resource.base_before + to = tfcoremock_simple_resource.base_after +} diff --git a/testing/equivalence-tests/tests/moved_with_drift/spec.json b/testing/equivalence-tests/tests/moved_with_drift/spec.json new file mode 100644 index 000000000000..f2ae34704748 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_drift/spec.json @@ -0,0 +1,5 @@ +{ + "description": "tests using the moved block combined with simulated drift", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/moved_with_drift/terraform.resource/2ecc718c-8d04-5774-5c36-7d69bf77d34e.json b/testing/equivalence-tests/tests/moved_with_drift/terraform.resource/2ecc718c-8d04-5774-5c36-7d69bf77d34e.json new file mode 100644 index 000000000000..2adef56f2bc0 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_drift/terraform.resource/2ecc718c-8d04-5774-5c36-7d69bf77d34e.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "2ecc718c-8d04-5774-5c36-7d69bf77d34e" + }, + "string": { + "string": "Hello, world!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/moved_with_drift/terraform.resource/e450ef2f-b80f-0cce-8bdb-14d88f48649c.json b/testing/equivalence-tests/tests/moved_with_drift/terraform.resource/e450ef2f-b80f-0cce-8bdb-14d88f48649c.json new file mode 100644 index 000000000000..ea5cd3851088 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_drift/terraform.resource/e450ef2f-b80f-0cce-8bdb-14d88f48649c.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "e450ef2f-b80f-0cce-8bdb-14d88f48649c" + }, + "string": { + "string": "Hello, drift!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/moved_with_drift/terraform.tfstate b/testing/equivalence-tests/tests/moved_with_drift/terraform.tfstate new file mode 100644 index 000000000000..97ea08cd35fe --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_drift/terraform.tfstate @@ -0,0 +1,53 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 3, + "lineage": "6cdc8ae0-8355-2447-7fb8-a9e9c2243e8f", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "base_before", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "e450ef2f-b80f-0cce-8bdb-14d88f48649c", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + }, + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "dependent", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "2ecc718c-8d04-5774-5c36-7d69bf77d34e", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [], + "dependencies": [ + "tfcoremock_simple_resource.base_before" + ] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/moved_with_refresh_only/.terraform.lock.hcl b/testing/equivalence-tests/tests/moved_with_refresh_only/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_refresh_only/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/moved_with_refresh_only/main.tf b/testing/equivalence-tests/tests/moved_with_refresh_only/main.tf new file mode 100644 index 000000000000..356b980f9b22 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_refresh_only/main.tf @@ -0,0 +1,20 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + + +resource "tfcoremock_simple_resource" "second" { + string = "Hello, world!" +} + +moved { + from = tfcoremock_simple_resource.first + to = tfcoremock_simple_resource.second +} diff --git a/testing/equivalence-tests/tests/moved_with_refresh_only/spec.json b/testing/equivalence-tests/tests/moved_with_refresh_only/spec.json new file mode 100644 index 000000000000..8cae386da067 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_refresh_only/spec.json @@ -0,0 +1,43 @@ +{ + "description": "tests displaying a moved resource within a refresh only plan", + "include_files": [], + "ignore_fields": {}, + "commands": [ + { + "name": "init", + "arguments": ["init"], + "capture_output": false + }, + { + "name": "plan", + "arguments": ["plan", "-out=equivalence_test_plan", "-no-color", "-refresh-only"], + "capture_output": true, + "output_file_name": "plan", + "has_json_output": false + }, + { + "name": "apply", + "arguments": ["apply", "-json", "equivalence_test_plan"], + "capture_output": true, + "output_file_name": "apply.json", + "has_json_output": true, + "streams_json_output": true + }, + { + "name": "show_state", + "arguments": ["show", "-json"], + "capture_output": true, + "output_file_name": "state.json", + "has_json_output": true, + "streams_json_output": false + }, + { + "name": "show_plan", + "arguments": ["show", "-json", "equivalence_test_plan"], + "capture_output": true, + "output_file_name": "plan.json", + "has_json_output": true, + "streams_json_output": false + } + ] +} diff --git a/testing/equivalence-tests/tests/moved_with_refresh_only/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json b/testing/equivalence-tests/tests/moved_with_refresh_only/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json new file mode 100644 index 000000000000..6c63be352de7 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_refresh_only/terraform.resource/70c47571-66c3-b1dc-2474-47a74b9c7886.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "70c47571-66c3-b1dc-2474-47a74b9c7886" + }, + "string": { + "string": "Hello, world!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/moved_with_refresh_only/terraform.tfstate b/testing/equivalence-tests/tests/moved_with_refresh_only/terraform.tfstate new file mode 100644 index 000000000000..89f82ba7123a --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_refresh_only/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "4a0f03a7-03fd-9357-9fd2-b3405139fa1d", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "first", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "70c47571-66c3-b1dc-2474-47a74b9c7886", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/moved_with_update/.terraform.lock.hcl b/testing/equivalence-tests/tests/moved_with_update/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_update/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/moved_with_update/main.tf b/testing/equivalence-tests/tests/moved_with_update/main.tf new file mode 100644 index 000000000000..a727802429dc --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_update/main.tf @@ -0,0 +1,19 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_simple_resource" "moved" { + string = "Hello, change!" +} + +moved { + from = tfcoremock_simple_resource.base + to = tfcoremock_simple_resource.moved +} diff --git a/testing/equivalence-tests/tests/moved_with_update/spec.json b/testing/equivalence-tests/tests/moved_with_update/spec.json new file mode 100644 index 000000000000..dceb24c2b3a3 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_update/spec.json @@ -0,0 +1,5 @@ +{ + "description": "this test updates a resource that has also been moved", + "include_files": [], + "ignore_fields": {} +} diff --git a/testing/equivalence-tests/tests/moved_with_update/terraform.resource/7da63aeb-f908-a112-9886-f29a0b0bd4ad.json b/testing/equivalence-tests/tests/moved_with_update/terraform.resource/7da63aeb-f908-a112-9886-f29a0b0bd4ad.json new file mode 100644 index 000000000000..dc908dc3c806 --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_update/terraform.resource/7da63aeb-f908-a112-9886-f29a0b0bd4ad.json @@ -0,0 +1,10 @@ +{ + "values": { + "id": { + "string": "7da63aeb-f908-a112-9886-f29a0b0bd4ad" + }, + "string": { + "string": "Hello, world!" + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/moved_with_update/terraform.tfstate b/testing/equivalence-tests/tests/moved_with_update/terraform.tfstate new file mode 100644 index 000000000000..b338b652862b --- /dev/null +++ b/testing/equivalence-tests/tests/moved_with_update/terraform.tfstate @@ -0,0 +1,30 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 1, + "lineage": "74f354aa-d7c6-5524-9573-cfdb625cb511", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_simple_resource", + "name": "base", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "bool": null, + "float": null, + "id": "7da63aeb-f908-a112-9886-f29a0b0bd4ad", + "integer": null, + "number": null, + "string": "Hello, world!" + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/multiple_block_types/spec.json b/testing/equivalence-tests/tests/multiple_block_types/spec.json index a3f0a709b918..675c10ef05b0 100644 --- a/testing/equivalence-tests/tests/multiple_block_types/spec.json +++ b/testing/equivalence-tests/tests/multiple_block_types/spec.json @@ -1,4 +1,5 @@ { + "description": "basic test case covering interaction between multiple blocks within a resource", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/multiple_block_types_update/spec.json b/testing/equivalence-tests/tests/multiple_block_types_update/spec.json index a3f0a709b918..4fa45babbaad 100644 --- a/testing/equivalence-tests/tests/multiple_block_types_update/spec.json +++ b/testing/equivalence-tests/tests/multiple_block_types_update/spec.json @@ -1,4 +1,5 @@ { + "description": "basic test covering interaction between multiple blocks within a resource, while updating", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_list/spec.json b/testing/equivalence-tests/tests/nested_list/spec.json index a3f0a709b918..c60dbb18e6a8 100644 --- a/testing/equivalence-tests/tests/nested_list/spec.json +++ b/testing/equivalence-tests/tests/nested_list/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating lists within lists", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_list_update/spec.json b/testing/equivalence-tests/tests/nested_list_update/spec.json index a3f0a709b918..24a0a6de69eb 100644 --- a/testing/equivalence-tests/tests/nested_list_update/spec.json +++ b/testing/equivalence-tests/tests/nested_list_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating a nested list attribute within a resource", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_map/spec.json b/testing/equivalence-tests/tests/nested_map/spec.json index a3f0a709b918..0590e1271449 100644 --- a/testing/equivalence-tests/tests/nested_map/spec.json +++ b/testing/equivalence-tests/tests/nested_map/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating maps within maps", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_map_update/spec.json b/testing/equivalence-tests/tests/nested_map_update/spec.json index a3f0a709b918..b313e21f2f25 100644 --- a/testing/equivalence-tests/tests/nested_map_update/spec.json +++ b/testing/equivalence-tests/tests/nested_map_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating a map nested within another map", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_objects/spec.json b/testing/equivalence-tests/tests/nested_objects/spec.json index a3f0a709b918..52a765cc685c 100644 --- a/testing/equivalence-tests/tests/nested_objects/spec.json +++ b/testing/equivalence-tests/tests/nested_objects/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating objects within objects", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_objects_update/spec.json b/testing/equivalence-tests/tests/nested_objects_update/spec.json index a3f0a709b918..cd8465f2f094 100644 --- a/testing/equivalence-tests/tests/nested_objects_update/spec.json +++ b/testing/equivalence-tests/tests/nested_objects_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating objects that are nested within other objects", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_set/spec.json b/testing/equivalence-tests/tests/nested_set/spec.json index a3f0a709b918..967ec8580baf 100644 --- a/testing/equivalence-tests/tests/nested_set/spec.json +++ b/testing/equivalence-tests/tests/nested_set/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating sets within sets", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/nested_set_update/spec.json b/testing/equivalence-tests/tests/nested_set_update/spec.json index a3f0a709b918..a1d1c9ab199b 100644 --- a/testing/equivalence-tests/tests/nested_set_update/spec.json +++ b/testing/equivalence-tests/tests/nested_set_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating sets when they are nested within other sets", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/null_provider_basic/spec.json b/testing/equivalence-tests/tests/null_provider_basic/spec.json index 4796fe90cae5..d32d9a3b2575 100644 --- a/testing/equivalence-tests/tests/null_provider_basic/spec.json +++ b/testing/equivalence-tests/tests/null_provider_basic/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating a simple resource created by the null provider", "include_files": [], "ignore_fields": { "apply.json": [ diff --git a/testing/equivalence-tests/tests/null_provider_delete/spec.json b/testing/equivalence-tests/tests/null_provider_delete/spec.json index a3f0a709b918..0ab998cb3f28 100644 --- a/testing/equivalence-tests/tests/null_provider_delete/spec.json +++ b/testing/equivalence-tests/tests/null_provider_delete/spec.json @@ -1,4 +1,5 @@ { + "description": "tests deleting a resource created by the null provider", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/replace_within_list/.terraform.lock.hcl b/testing/equivalence-tests/tests/replace_within_list/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_list/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/replace_within_list/dynamic_resources.json b/testing/equivalence-tests/tests/replace_within_list/dynamic_resources.json new file mode 100644 index 000000000000..5d8e42bdaacb --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_list/dynamic_resources.json @@ -0,0 +1,20 @@ +{ + "tfcoremock_list": { + "attributes": { + "list": { + "type": "list", + "required": true, + "list": { + "type": "object", + "object": { + "id": { + "type": "string", + "replace": true, + "required": true + } + } + } + } + } + } +} diff --git a/testing/equivalence-tests/tests/replace_within_list/main.tf b/testing/equivalence-tests/tests/replace_within_list/main.tf new file mode 100644 index 000000000000..3f4d34b617d9 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_list/main.tf @@ -0,0 +1,26 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_list" "list" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + + list = [ + { + id = "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + id = "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + id = "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + ] +} diff --git a/testing/equivalence-tests/tests/replace_within_list/spec.json b/testing/equivalence-tests/tests/replace_within_list/spec.json new file mode 100644 index 000000000000..002a35bddde4 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_list/spec.json @@ -0,0 +1,6 @@ +{ + "description": "tests the behaviour of an attribute within a list causing a resource to be replaced", + "include_files": [], + "ignore_fields": {} +} + diff --git a/testing/equivalence-tests/tests/replace_within_list/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json b/testing/equivalence-tests/tests/replace_within_list/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json new file mode 100644 index 000000000000..b1c22ca9df23 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_list/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json @@ -0,0 +1,32 @@ +{ + "values": { + "id": { + "string": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "list": { + "list": [ + { + "object": { + "id": { + "string": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + } + } + }, + { + "object": { + "id": { + "string": "6A8C6A29-D417-480A-BE19-12D7398B3178" + } + } + }, + { + "object": { + "id": { + "string": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/replace_within_list/terraform.tfstate b/testing/equivalence-tests/tests/replace_within_list/terraform.tfstate new file mode 100644 index 000000000000..9526deff96cf --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_list/terraform.tfstate @@ -0,0 +1,36 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 4, + "lineage": "a0e7bfac-ce3d-9720-1b4e-d6e6c58cf620", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_list", + "name": "list", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "list": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "6A8C6A29-D417-480A-BE19-12D7398B3178" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + ] + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/replace_within_map/.terraform.lock.hcl b/testing/equivalence-tests/tests/replace_within_map/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_map/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/replace_within_map/dynamic_resources.json b/testing/equivalence-tests/tests/replace_within_map/dynamic_resources.json new file mode 100644 index 000000000000..6034bef4a420 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_map/dynamic_resources.json @@ -0,0 +1,20 @@ +{ + "tfcoremock_map": { + "attributes": { + "map": { + "type": "map", + "required": true, + "map": { + "type": "object", + "object": { + "id": { + "type": "string", + "replace": true, + "required": true + } + } + } + } + } + } +} diff --git a/testing/equivalence-tests/tests/replace_within_map/main.tf b/testing/equivalence-tests/tests/replace_within_map/main.tf new file mode 100644 index 000000000000..aafa092a335a --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_map/main.tf @@ -0,0 +1,26 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_map" "map" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + + map = { + "key_one" = { + id = "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_two" = { + id = "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + "key_three" = { + id = "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + } +} diff --git a/testing/equivalence-tests/tests/replace_within_map/spec.json b/testing/equivalence-tests/tests/replace_within_map/spec.json new file mode 100644 index 000000000000..602fcd52ce9c --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_map/spec.json @@ -0,0 +1,6 @@ +{ + "description": "tests the behaviour of an attribute within a map causing a resource to be replaced", + "include_files": [], + "ignore_fields": {} +} + diff --git a/testing/equivalence-tests/tests/replace_within_map/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json b/testing/equivalence-tests/tests/replace_within_map/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json new file mode 100644 index 000000000000..86c7de1ea7f7 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_map/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json @@ -0,0 +1,32 @@ +{ + "values": { + "id": { + "string": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "map": { + "map": { + "key_one": { + "object": { + "id": { + "string": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + } + } + }, + "key_three": { + "object": { + "id": { + "string": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + } + }, + "key_two": { + "object": { + "id": { + "string": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/replace_within_map/terraform.tfstate b/testing/equivalence-tests/tests/replace_within_map/terraform.tfstate new file mode 100644 index 000000000000..5ca2114e26f1 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_map/terraform.tfstate @@ -0,0 +1,36 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 4, + "lineage": "761a9430-9f20-5cf3-d66e-c3e345115ed1", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_map", + "name": "map", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "map": { + "key_one": { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + "key_three": { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + "key_two": { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/replace_within_object/.terraform.lock.hcl b/testing/equivalence-tests/tests/replace_within_object/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_object/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/replace_within_object/dynamic_resources.json b/testing/equivalence-tests/tests/replace_within_object/dynamic_resources.json new file mode 100644 index 000000000000..641f64640c0f --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_object/dynamic_resources.json @@ -0,0 +1,17 @@ +{ + "tfcoremock_object": { + "attributes": { + "object": { + "type": "object", + "required": true, + "object": { + "id": { + "type": "string", + "replace": true, + "required": true + } + } + } + } + } +} diff --git a/testing/equivalence-tests/tests/replace_within_object/main.tf b/testing/equivalence-tests/tests/replace_within_object/main.tf new file mode 100644 index 000000000000..9cda772181d9 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_object/main.tf @@ -0,0 +1,18 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_object" "object" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + + object = { + id = "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + } +} diff --git a/testing/equivalence-tests/tests/replace_within_object/spec.json b/testing/equivalence-tests/tests/replace_within_object/spec.json new file mode 100644 index 000000000000..e1601f23bc97 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_object/spec.json @@ -0,0 +1,6 @@ +{ + "description": "tests the behaviour of an attribute within an object causing a resource to be replaced", + "include_files": [], + "ignore_fields": {} +} + diff --git a/testing/equivalence-tests/tests/replace_within_object/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json b/testing/equivalence-tests/tests/replace_within_object/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json new file mode 100644 index 000000000000..49395abd3557 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_object/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json @@ -0,0 +1,14 @@ +{ + "values": { + "id": { + "string": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "object": { + "object": { + "id": { + "string": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/replace_within_object/terraform.tfstate b/testing/equivalence-tests/tests/replace_within_object/terraform.tfstate new file mode 100644 index 000000000000..1162e6a2663c --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_object/terraform.tfstate @@ -0,0 +1,28 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 4, + "lineage": "02b0a9ca-8da4-ad32-a144-3cc984a1d395", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_object", + "name": "object", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "object": { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/replace_within_set/.terraform.lock.hcl b/testing/equivalence-tests/tests/replace_within_set/.terraform.lock.hcl new file mode 100644 index 000000000000..d2d6193ccbe7 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_set/.terraform.lock.hcl @@ -0,0 +1,22 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/tfcoremock" { + version = "0.1.1" + constraints = "0.1.1" + hashes = [ + "h1:K5ImnTbl0eD02BQgVe6pNn5w2wW07j9t7iDUwqPvcy0=", + "zh:0219ffa02c6f2cf1f519ea42a89615cfbab8219803bcdb4a3614793952b1f5a8", + "zh:13915c1eb4f2ad384c6ce343eebe108ddfb0a103e19f1d8b199c0af8e57bc74a", + "zh:1c265814efa730540a475f76a8045d90a70c22010d6f2eee45f69e973ce10580", + "zh:34d58f6bf64afc491359ad1455007e1eb9aef60be17909096ec88a802b6f72b2", + "zh:7a7d709aeb7b2945f5a9a0497976a85bceb07b2cbf236c8c1bb0b7b079b839ab", + "zh:890df766e9b839623b1f0437355032a3c006226a6c200cd911e15ee1a9014e9f", + "zh:965fbb6042acd6fbf77a9b5c3321edbfa0aa6bf0359394afbf0a7e1392245324", + "zh:9e4ac8eae03d1243b9283b202132c007d5c4ee533d1c5efc690403caaaaa7aac", + "zh:a51833ca1c6983e32a937ea3864b6037c1ccb97a4917cafb38771a3aa583cc77", + "zh:ac2eba5efca9f0bf4ecca3b23c2a89c4318ef7cda45e374811e42cced0aa660b", + "zh:c77663f4c0e4ca799e5f1abfa94cfe15f36e9879e637a9196ea01fcaeba13286", + "zh:dc0ab43f1affe80e117cea108780afe53d7c97357566ded87f53221828c875de", + ] +} diff --git a/testing/equivalence-tests/tests/replace_within_set/dynamic_resources.json b/testing/equivalence-tests/tests/replace_within_set/dynamic_resources.json new file mode 100644 index 000000000000..25aa1369a760 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_set/dynamic_resources.json @@ -0,0 +1,20 @@ +{ + "tfcoremock_set": { + "attributes": { + "set": { + "type": "set", + "required": true, + "set": { + "type": "object", + "object": { + "id": { + "type": "string", + "replace": true, + "required": true + } + } + } + } + } + } +} diff --git a/testing/equivalence-tests/tests/replace_within_set/main.tf b/testing/equivalence-tests/tests/replace_within_set/main.tf new file mode 100644 index 000000000000..64a599b9d6cf --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_set/main.tf @@ -0,0 +1,26 @@ +terraform { + required_providers { + tfcoremock = { + source = "hashicorp/tfcoremock" + version = "0.1.1" + } + } +} + +provider "tfcoremock" {} + +resource "tfcoremock_set" "set" { + id = "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + + set = [ + { + id = "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + id = "07F887E2-FDFF-4B2E-9BFB-B6AA4A05EDB9" + }, + { + id = "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + ] +} diff --git a/testing/equivalence-tests/tests/replace_within_set/spec.json b/testing/equivalence-tests/tests/replace_within_set/spec.json new file mode 100644 index 000000000000..3a08ac22e42b --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_set/spec.json @@ -0,0 +1,6 @@ +{ + "description": "tests the behaviour of an attribute within a set causing a resource to be replaced", + "include_files": [], + "ignore_fields": {} +} + diff --git a/testing/equivalence-tests/tests/replace_within_set/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json b/testing/equivalence-tests/tests/replace_within_set/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json new file mode 100644 index 000000000000..b8f76cc177c2 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_set/terraform.resource/F40F2AB4-100C-4AE8-BFD0-BF332A158415.json @@ -0,0 +1,32 @@ +{ + "values": { + "id": { + "string": "F40F2AB4-100C-4AE8-BFD0-BF332A158415" + }, + "set": { + "set": [ + { + "object": { + "id": { + "string": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + } + } + }, + { + "object": { + "id": { + "string": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + } + } + }, + { + "object": { + "id": { + "string": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/testing/equivalence-tests/tests/replace_within_set/terraform.tfstate b/testing/equivalence-tests/tests/replace_within_set/terraform.tfstate new file mode 100644 index 000000000000..8c33aca3f060 --- /dev/null +++ b/testing/equivalence-tests/tests/replace_within_set/terraform.tfstate @@ -0,0 +1,36 @@ +{ + "version": 4, + "terraform_version": "1.3.7", + "serial": 4, + "lineage": "a0f911d6-cc86-a0d6-4d4c-967c11b80966", + "outputs": {}, + "resources": [ + { + "mode": "managed", + "type": "tfcoremock_set", + "name": "set", + "provider": "provider[\"registry.terraform.io/hashicorp/tfcoremock\"]", + "instances": [ + { + "schema_version": 0, + "attributes": { + "id": "F40F2AB4-100C-4AE8-BFD0-BF332A158415", + "set": [ + { + "id": "3BFC1A84-023F-44FA-A8EE-EFD88E18B8F7" + }, + { + "id": "4B7178A8-AB9D-4FF4-8B3D-48B754DE537B" + }, + { + "id": "56C7E07F-B9DF-4799-AF62-E703D1167A51" + } + ] + }, + "sensitive_attributes": [] + } + ] + } + ], + "check_results": null +} diff --git a/testing/equivalence-tests/tests/simple_object/spec.json b/testing/equivalence-tests/tests/simple_object/spec.json index a3f0a709b918..e9b771e0a2e0 100644 --- a/testing/equivalence-tests/tests/simple_object/spec.json +++ b/testing/equivalence-tests/tests/simple_object/spec.json @@ -1,4 +1,5 @@ { + "description": "tests creating a simple object with primitive attributes", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/simple_object_empty/spec.json b/testing/equivalence-tests/tests/simple_object_empty/spec.json index a3f0a709b918..97195acb6167 100644 --- a/testing/equivalence-tests/tests/simple_object_empty/spec.json +++ b/testing/equivalence-tests/tests/simple_object_empty/spec.json @@ -1,4 +1,5 @@ { + "description": "tests removing all attributes from an object", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/simple_object_null/spec.json b/testing/equivalence-tests/tests/simple_object_null/spec.json index a3f0a709b918..9f4e3080da28 100644 --- a/testing/equivalence-tests/tests/simple_object_null/spec.json +++ b/testing/equivalence-tests/tests/simple_object_null/spec.json @@ -1,4 +1,5 @@ { + "description": "tests setting an object within a resource to null by removing it from the config", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/simple_object_replace/spec.json b/testing/equivalence-tests/tests/simple_object_replace/spec.json index a3f0a709b918..4cc29f57732f 100644 --- a/testing/equivalence-tests/tests/simple_object_replace/spec.json +++ b/testing/equivalence-tests/tests/simple_object_replace/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating an attribute that forces the overall resource to be replaced", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/simple_object_update/spec.json b/testing/equivalence-tests/tests/simple_object_update/spec.json index a3f0a709b918..37fb69faad86 100644 --- a/testing/equivalence-tests/tests/simple_object_update/spec.json +++ b/testing/equivalence-tests/tests/simple_object_update/spec.json @@ -1,4 +1,5 @@ { + "description": "tests updating objects when they are nested in other objects", "include_files": [], "ignore_fields": {} } diff --git a/testing/equivalence-tests/tests/variables_and_outputs/spec.json b/testing/equivalence-tests/tests/variables_and_outputs/spec.json index a3f0a709b918..406d082514dd 100644 --- a/testing/equivalence-tests/tests/variables_and_outputs/spec.json +++ b/testing/equivalence-tests/tests/variables_and_outputs/spec.json @@ -1,4 +1,5 @@ { + "description": "tests a set of basic variables and outputs", "include_files": [], "ignore_fields": {} }