Skip to content

Confusing error messages when the provider config doesn't match expected schema #536

@mjeffryes

Description

@mjeffryes

What happened?

Configuring providers for a TF module can be tricky because we don't have static typing. Unfortunately, the error message when you get the config wrong is not super clear as to:

  • What resource is incorrect (it initially looks like a problem with the module resource, but it's actually the provider resource that's misconfigured)
  • That it's the config inputs that are wrong
  • How you might fix it

While we stuck with dynamic typing for now, we could probably improve the error message.

Example

Program

const moduleProvider = new azureAgents.Provider("agentsProvider", {
  azurerm: pulumiAzureProvider.terraformConfig(),
});

const azureDevopsAgents = new azureAgents.Module(`${envKey}-azure-devops-agents`, {
  ...
}, {provider: moduleProvider});

Current error output

Diagnostics:
  azure-agents:index:Module (prod-azure-devops-agents):
    error: 
    Error: Extraneous JSON object property
    
      on pulumi.tf.json line 140, in provider.azurerm:
     140:       "result": {
    
    No argument or block type is named "result".
    error: Preview failed: Plan failed: error running plan: exit status 1

Suggestion for better error output

Diagnostics:
  azure-agents:index:Provder (agentsProvider):
    Failed to parse provider config for azurerm: 
      Error: Extraneous JSON object property
      
        on pulumi.tf.json line 140, in provider.azurerm:
       140:       "result": {
      
      No argument or block type is named "result".
    error: Preview failed: Plan failed: error running plan: exit status 1

Output of pulumi about

Reporting on behalf of a user so I don't have exact versions, but manifests with current latest versions:

pulumi: v3.192.0
pulumi-azure: v6.25.0
pulumi-terraform-module: v0.1.8

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact/usabilitySomething that impacts users' ability to use the product easily and intuitivelykind/bugSome behavior is incorrect or out of spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions