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

Provider attributes api_key and account_id should be optional #2486

Open
balonik opened this issue Oct 12, 2023 · 2 comments
Open

Provider attributes api_key and account_id should be optional #2486

balonik opened this issue Oct 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@balonik
Copy link

balonik commented Oct 12, 2023

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.

Actual Behavior

A provider definition like:

provider "newrelic" {
  account_id = var.new_relic_account_id
}

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

@pranav-new-relic
Copy link
Member

pranav-new-relic commented Nov 2, 2023

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.

image

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 pranav-new-relic added the enhancement New feature or request label Nov 2, 2023
@balonik
Copy link
Author

balonik commented Nov 3, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants