hashicorp / hashicorp/terraform-plugin-testing

Proposal: Add `context`-aware variants of functions in `resource.TestCase`

Open
#88 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
68
Forks
22
Avg merge
2d 12h
Merged PRs (30d)
1

Description

### Use cases

In some cases, `TestCheckFunc`s, `ErrorCheckFunc`s, etc., may need to log. Without access to a `context`, they won't have access to a `tflog`.

Providers can recreate their own test logger (e.g. https://github.com/hashicorp/terraform-provider-aws/pull/29764), but don't have access to the `test_step_number` and other logging fields.

### Attempted solutions

Implemented our own with only the `test_name` field in https://github.com/hashicorp/terraform-provider-aws/pull/29764

### Proposal

Add `context`-aware versions of functions passed to `resource.TestCase` so that the logging `context` supplied by the testing framework can be passed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.