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
Implements version update notifications similar to Terraform's pattern.
When running tflint --version, users see a notification if a newer version
is available on GitHub Releases.
// Wait for update check to complete and print notification if available
117
+
ifupdateChan!=nil {
118
+
updateInfo:=<-updateChan
119
+
ifupdateInfo!=nil&&updateInfo.Available {
120
+
fmt.Fprintf(cli.outStream, "\nYour version of TFLint is out of date! The latest version is %s.\nYou can update by downloading from https://github.com/terraform-linters/tflint/releases\n", updateInfo.Latest)
121
+
}
122
+
}
123
+
49
124
returnExitCodeOK
50
125
}
51
126
52
-
funcgetPluginVersions(optsOptions) []string {
53
-
// Load configuration files to print plugin versions
127
+
func (cli*CLI) printVersionJSON(optsOptions, updateInfo*versioncheck.UpdateInfo) int {
128
+
workingDirs, err:=findWorkingDirs(opts)
129
+
iferr!=nil {
130
+
cli.formatter.Print(tflint.Issues{}, fmt.Errorf("Failed to find workspaces; %w", err), map[string][]byte{})
131
+
returnExitCodeError
132
+
}
133
+
134
+
// Build output
135
+
output:=VersionOutput{
136
+
Version: tflint.Version.String(),
137
+
UpdateCheckEnabled: versioncheck.Enabled(),
138
+
}
139
+
140
+
ifupdateInfo!=nil {
141
+
output.UpdateAvailable=updateInfo.Available
142
+
ifupdateInfo.Available {
143
+
output.LatestVersion=updateInfo.Latest
144
+
}
145
+
}
146
+
147
+
// Handle multiple working directories for --recursive
148
+
ifopts.Recursive&&len(workingDirs) >1 {
149
+
// Track all unique plugins across modules
150
+
pluginMap:=make(map[string]PluginVersion)
151
+
152
+
for_, wd:=rangeworkingDirs {
153
+
varplugins []PluginVersion
154
+
err:=cli.withinChangedDir(wd, func() error {
155
+
plugins=getPluginVersions(opts)
156
+
returnnil
157
+
})
158
+
iferr!=nil {
159
+
log.Printf("[ERROR] Failed to get plugins for %s: %s", wd, err)
Copy file name to clipboardExpand all lines: docs/user-guide/environment_variables.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,10 @@ Below is a list of environment variables available in TFLint.
8
8
- Configure the config file path. See [Configuring TFLint](./config.md).
9
9
-`TFLINT_PLUGIN_DIR`
10
10
- Configure the plugin directory. See [Configuring Plugins](./plugins.md).
11
+
-`TFLINT_DISABLE_VERSION_CHECK`
12
+
- Disable version update notifications when running `tflint --version`. Set to `1` to disable.
13
+
-`GITHUB_TOKEN`
14
+
- (Optional) Used for authenticated GitHub API requests when checking for updates and downloading plugins. Increases the rate limit from 60 to 5000 requests per hour. Useful if you encounter rate limit errors. You can obtain a token by creating a [GitHub personal access token](https://github.com/settings/tokens); no special scopes are required.
11
15
-`TFLINT_EXPERIMENTAL`
12
16
- Enable experimental features. Note that experimental features are subject to change without notice. Currently only [Keyless Verification](./plugins.md#keyless-verification-experimental) are supported.
0 commit comments