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

Reference validation for remaining parts of the language #1364

Open
1 of 10 tasks
radeksimko opened this issue Aug 29, 2023 · 0 comments
Open
1 of 10 tasks

Reference validation for remaining parts of the language #1364

radeksimko opened this issue Aug 29, 2023 · 0 comments

Comments

@radeksimko
Copy link
Member

radeksimko commented Aug 29, 2023

Context

Reference validation was introduced as part of #1357 and further refactored in #1346

In short, this produces the following diagnostics

Screenshot 2023-08-29 at 14 41 28

We have decided to implement only validation of variables (var.* references) and local values (local.*). All other references are currently excluded from validation.

  • data sources (data.*)
  • resources
  • modules
  • "extensions"
    • self.* references
    • each.*
    • count.index
  • provider aliases (e.g. aws.east in a provider attribute of a resource)

Most of these were initially excluded because they are fully or in part dependent on us knowing full schema where we more often may not. e.g. user may be using provider supercloud and has references to resources such as supercloud_instance.foo.public_ip and because we may not know the schema of supercloud we cannot tell whether the full reference is valid or not, i.e. whether public_ip exists on supercloud_instance.

Ideally we should be able to at least validate parts of the reference, e.g. tell whether supercloud_instance.foo is valid, i.e. whether resource "supercloud_instance" "foo" was declared or not, but this all requires a more complex solution we have not implemented yet.

Proposal

  • validations: Enable reference validation of locals #1381
  • Enable reference validation for resources (e.g. aws_instance.* or resource.aws_instance.*)
  • Enable reference validation for data sources (data.*)
  • Enable reference validation for module outputs (module.*)
  • Enable reference validation for provider aliases (e.g. aws.foo-alias in provider attribute)
  • Enable reference validation concerning language extensions
    • self.*
    • each.*
    • count.index
    • references to an item being looped over in dynamic block's content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant