Skip to content

Consider SDK Logging of Terraform CLI Version #180

@bflad

Description

@bflad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions