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

Consider SDK Logging of Terraform CLI Version #180

Open
bflad opened this issue Apr 20, 2022 · 1 comment
Open

Consider SDK Logging of Terraform CLI Version #180

bflad opened this issue Apr 20, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@bflad
Copy link
Member

bflad commented Apr 20, 2022

terraform-plugin-go version

v0.9.0

Use cases

Provider developers and SDK maintainers often need to know the associated Terraform CLI version when triaging issues. Certain classes of issues are resolved via Terraform CLI upgrades. Unless the Terraform CLI portion of logging is enabled, which does include the Terraform CLI version as a log entry, there is currently no SDK-side logging of the version.

Attempted solutions

Asking issue reporters in issue templates. Looking for version information from the Terraform CLI log entries, if they were enabled.

Proposal

The ConfigureProvider RPC request contains the TerraformVersion field, which should be appropriately populated by Terraform CLI. The RPC handlers could either:

  • Emit a single "more visible" log entry, e.g. logging.ProtocolDebug(ctx, "Detected Terraform CLI version: "+req.TerraformVersion)
  • Add the version information to the protocol logging context, e.g. tfsdklog.SubsystemWith(ctx, SubsystemProto, KeyTfVersion, version)

If more or all of the RPCs contained the version, the latter would generally be preferred so the information propagates out all associated log entries, however the single entry may be less confusing for now.

References

@bflad bflad added the enhancement New feature or request label Apr 20, 2022
@bflad
Copy link
Member Author

bflad commented Apr 26, 2022

For completeness: another potential option here would be to use the tfsdklog.SubsystemWith() approach, but save the Terraform CLI version in the provider server and use that saved value (if found) on the other subsequent RPCs, since it is generally expected that a provider server would only ever interact with a single client over its lifetime. However, one anti-example of that type of approach would be when using a provider server in reattach mode, where it is possible for developers to swap the Terraform CLI being used while keeping the same server running.

@bflad bflad self-assigned this Jul 1, 2022
@bflad bflad modified the milestone: v0.10.0 Jul 1, 2022
@bflad bflad removed their assignment Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant