-
Notifications
You must be signed in to change notification settings - Fork 181
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 block for github shows as invalid for an empty app_auth block #1597
Comments
Hey @scott-doyland-burrows I was able to reproduce it. It looks like this is an interesting edge case of how the schema, as codified in https://github.com/integrations/terraform-provider-github/blob/4a5ab5f5b08813c52cbf2f7b917aabd7fda623cd/github/provider.go#L69-L97 gets interpreted. As per the linked LOC, the fields under the Either way the validation should reflect the behaviour of Terraform Core/CLI. |
After debugging this and looking into the schema, it turns out everything might be working as expected. If a resources uses the github provider, you end up with validation errors in Terraform terraform {
required_providers {
github = {
source = "integrations/github"
}
}
}
provider "github" {
alias = "some-alias"
owner = "some-owner"
app_auth {}
}
resource "github_actions_environment_secret" "name" {
provider = github.some-alias
environment = "value"
repository = "value"
secret_name = "value"
} Running
So the question we can discuss here is: Do we want to suppress errors for unused providers? @scott-doyland-burrows Are you using the provider anywhere in your configuration? If not, would you be able to get rid of the provider block? |
I am not sure what you mean by: Are you using the provider anywhere in your configuration? If not, would you be able to get rid of the provider block? I am using the provider as below: If I set the following - which is what I want to do, as the
If I do NOT set environment variables for the following, then
I set the above environment variables then However, vscode still shows the errors. Does the vscode extension actually use the github provider itself to see what is/isn't required? If so then I guess it is working as designed from a provider point of view, but it is then impossible for vscode to behave as we would want. vscode doesn't know I have the environment variables set. |
Thank you for the additional context, @scott-doyland-burrows. The provider alias had me confused. I can reproduce the behavior and we will look into solutions. But you're right that it might be difficult, because inside VS Code we don't know about most environment variables. |
Thanks for the report, I have opened #1616 to describe the problem in a more general way and added some context. It is something we will likely have to address soon as it's obviously wrong/misleading. I also filed hashicorp/terraform-ls#1481 which relates to the other problem we ran into while trying to reproduce the problem earlier. For now I'm going to close this issue but feel free to subscribe to either of the two new issues. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Extension Version
v2.82.2
VS Code Version
Version: 1.82.2 (user setup)
Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
Date: 2023-09-14T05:55:25.390Z
Electron: 25.8.1
ElectronBuildId: 23779380
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19044
Operating System
Windows 10 using WSL
Terraform Version
Terraform v1.6.1 on linux_amd64
Steps to Reproduce
Create a provider block as per the terraform configuration below and it shows an invalid
app_auth
block:However, the
app_auth
block shown is valid - it can be empty as the values required can be passed in as environment variables.Terraform works fine with the code as shown, and
terraform fmt
shows no issues.Expected Behavior
The
app_auth
block should show as valid.Actual Behavior
Terraform Configuration
Project Structure
Gist
No response
Anything Else?
No response
Workarounds
No response
References
No response
Help Wanted
Community Note
The text was updated successfully, but these errors were encountered: