Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helper/resource: Add terraform plan output to TRACE logging #1058

Merged
merged 3 commits into from Sep 14, 2022

Conversation

bflad
Copy link
Member

@bflad bflad commented Sep 14, 2022

Closes #698

For example:

$ TF_ACC=1 TF_LOG=TRACE go test -count=1 -run='TestTest_TestStep_ExternalProviders_DifferentVersions' -v ./helper/resource
...
2022-09-13T22:27:17.924-0400 [TRACE] sdk.helper_resource: Created plan with changes:
  test_terraform_plan=
  |
  | 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:
  |
  |   # null_resource.test will be created
  |   + resource "null_resource" "test" {
  |       + id = (known after apply)
  |     }
  |
  | Plan: 1 to add, 0 to change, 0 to destroy.
   test_name=TestTest_TestStep_ExternalProviders_DifferentVersions test_step_number=1 test_terraform_path=/opt/homebrew/bin/terraform test_working_directory=/var/folders/f3/2mhr8hkx72z9dllv0ry81zm40000gq/T/plugintest2492851432
...
2022-09-13T22:27:18.816-0400 [TRACE] sdk.helper_resource: Created plan with no changes: test_working_directory=/var/folders/f3/2mhr8hkx72z9dllv0ry81zm40000gq/T/plugintest2492851432 test_name=TestTest_TestStep_ExternalProviders_DifferentVersions test_step_number=2 test_terraform_path=/opt/homebrew/bin/terraform
...

Reference: #698

For example:

```console
$ TF_ACC=1 TF_LOG=TRACE go test -count=1 -run='TestTest_TestStep_ExternalProviders_DifferentVersions' -v ./helper/resource
...
2022-09-13T22:27:17.924-0400 [TRACE] sdk.helper_resource: Created plan with changes:
  test_terraform_plan=
  |
  | 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:
  |
  |   # null_resource.test will be created
  |   + resource "null_resource" "test" {
  |       + id = (known after apply)
  |     }
  |
  | Plan: 1 to add, 0 to change, 0 to destroy.
   test_name=TestTest_TestStep_ExternalProviders_DifferentVersions test_step_number=1 test_terraform_path=/opt/homebrew/bin/terraform test_working_directory=/var/folders/f3/2mhr8hkx72z9dllv0ry81zm40000gq/T/plugintest2492851432
...
2022-09-13T22:27:18.816-0400 [TRACE] sdk.helper_resource: Created plan with no changes: test_working_directory=/var/folders/f3/2mhr8hkx72z9dllv0ry81zm40000gq/T/plugintest2492851432 test_name=TestTest_TestStep_ExternalProviders_DifferentVersions test_step_number=2 test_terraform_path=/opt/homebrew/bin/terraform
...
```
@bflad bflad added enhancement New feature or request subsystem/tests Issues and feature requests related to the testing framework. labels Sep 14, 2022
@bflad bflad added this to the v2.23.0 milestone Sep 14, 2022
@bflad bflad requested a review from a team as a code owner September 14, 2022 02:36
Copy link
Contributor

@bendbennett bendbennett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bflad bflad merged commit 0f41bb0 into main Sep 14, 2022
5 checks passed
@bflad bflad deleted the bflad/testing-framework-log-plan-stdout branch September 14, 2022 13:15
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days . This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request subsystem/tests Issues and feature requests related to the testing framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output of Terraform CLI Plan Difference During Acceptance Testing
2 participants