terraform-plugin-go version
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
terraform-plugin-go version
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
ConfigureProviderRPC request contains theTerraformVersionfield, which should be appropriately populated by Terraform CLI. The RPC handlers could either:logging.ProtocolDebug(ctx, "Detected Terraform CLI version: "+req.TerraformVersion)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