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

Improve Troubleshooting Recommendations for Argument Not Found Errors #28114

Closed
bflad opened this issue Mar 16, 2021 · 1 comment
Closed

Improve Troubleshooting Recommendations for Argument Not Found Errors #28114

bflad opened this issue Mar 16, 2021 · 1 comment
Labels
enhancement new new issue not yet triaged UX User experience enhancements

Comments

@bflad
Copy link
Member

bflad commented Mar 16, 2021

Current Terraform Version

v0.14.8

Use-cases

  • When developing against an existing Terraform configuration which is pinned to older Terraform Provider versions, there can be arguments which are only available in newer Terraform Provider versions, e.g.
resource "example_thing" "example" {
  newer_attribute = "example"
}
  • When developing a Terraform configuration using a Terraform Provider that has a Resource with multiple blocks, it is possible to incorrectly add an argument to the wrong nesting level, e.g.
resource "example_thing" "example" {
  block {
    # nested_attribute belongs here
  }

  nested_attribute = "example"
}

Both of these will currently generate a generic HCL error such as:

$ terraform plan
...
Error: Unsupported argument

on main.tf line ##, in resource "example_thing" "example":
34: newer_attribute = "example"

An argument named "newer_attribute" is not expected here.

Terraform CLI and Terraform Provider repositories will occasionally receive new GitHub issues relating to this when typically there are two helpful recommendations:

  • Checking the provider version to ensure it is up to date
  • Checking the resource documentation

For newer practitioners or those unfamiliar with why they might be receiving this error, it might be helpful to include some of this additional troubleshooting information with the error message.

Proposal

For resource arguments, catch and wrap the HCL error message with some additional Terraform context:

Error: Unsupported argument

on main.tf line ##, in resource "example_thing" "example":
34: newer_attribute = "example"

An argument named "newer_attribute" is not expected here. Use the resource documentation to verify that this resource supports this argument and that the provider version being used with this configuration is up to date with the expected resource functionality.

The same could theoretically be tailored and applied for provider arguments as well.

References

@bflad bflad added enhancement new new issue not yet triaged labels Mar 16, 2021
@bflad bflad added the UX User experience enhancements label Dec 1, 2021
@bflad
Copy link
Member Author

bflad commented May 14, 2024

Given no 👍 interest or commentary, closing to reduce issue noise.

@bflad bflad closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged UX User experience enhancements
Projects
None yet
Development

No branches or pull requests

1 participant