Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

mcasperson
Copy link
Contributor

@mcasperson mcasperson commented Feb 16, 2025

Expectation

This PR is a proof of concept for displaying additional diagnostic details when an error is returned. The PR is provided as a way of starting a discussion around whether this feature is useful and provides a working example that may be of use.

If this feature or the implementation is not appropriate, I'm happy to close this PR.

Why

A single version of the TF provider must support multiple versions of Octopus. Not all resources will be supported by all versions of Octopus, and when a resource that is not supported by the version of Octopus is modified, the error presented to the user is the API response.

It is reasonable to assume this error to be passed to customer facing teams like the support team, CSMs, SEs, or included in an issue in this repo.

To help the support teams, this PR wraps all calls to diagnostics.AddError and displays a common set of diagnostic information including:

  • Octopus Version
  • Terraform Version
  • Provider file name (which embeds the provider version)

Embedding these details in all error messages aim to improve the DevEx of our customers by:

  • Reducing cognitive load - our customers no longer need to source these versions manually
  • Improving feedback loops - having accurate versions may remove the need for support teams to ask for these details in a follow up email.

Changes

The error output now looks like this. Note the Executable, Terraform Version, and Octopus Version fields in the output.

│ Error: error while creating deployment freeze
│ 
│   with octopusdeploy_deployment_freeze.freeze,
│   on freeze.tf line 1, in resource "octopusdeploy_deployment_freeze" "freeze":
│    1: resource "octopusdeploy_deployment_freeze" "freeze" {
│ 
│ Octopus API error: There was a problem with your request. [The ProjectEnvironmentScope field is required.] 
│ Please ensure these details are included in any error report you raise.
│ Executable: terraform-provider-octopusdeploy_v0.40.4
│ Terraform Version: 1.10.5
│ Octopus Version: Unknown

Note that Octopus Version is Unknown now because of a bug in the client library.

@mcasperson mcasperson closed this Mar 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant