You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provider attributes api_key and account_id should be as optional, because they can be set using environment variables. Having them as required is causing false positives for linters, in my case terraform-ls.
Hi @balonik, I see what you're saying - I'm not sure if a recent update to my linter/extension caused this, as I haven't seen this warning until recently.
However, I'm not sure if we would be okay with making account_id and api_key optional; these can certainly be set from the environment, but we would need to think through this, for instance, the impact of this change combined with NEW_RELIC_ACCOUNT_ID and NEW_RELIC_API_KEY being absent in the environment. I shall try checking with the team on this when time permits - this is certainly an interesting observation. Thank you!
@pranav-new-relic 👍🏻
I'd say a start would be to see how other TF providers do it. There are plenty of TF providers that also have option to use environment variables or properties and do not have this linting issue.
Provider attributes
api_key
andaccount_id
should be as optional, because they can be set using environment variables. Having them as required is causing false positives for linters, in my caseterraform-ls
.Actual Behavior
A provider definition like:
will cause error/warning:
Required attribute "api_key" not specified: An attribute named "api_key" is required here
Expected Behavior
No error/warning by linter.
Versions
Terraform version:
1.6.0
Provider version:
3.27.2
The text was updated successfully, but these errors were encountered: