tflint azure devops 代理未找到

问题描述 投票:0回答:1

我对 tflint 有一种奇怪的行为。 我在 azure 自托管 DevOps 代理中遇到错误。

[INFO] Load config: .tflint.hcl
[INFO] file not found
[INFO] Load config: /home/AzDevOps/snap/tflint/52/.tflint.hcl
[INFO] file not found
[INFO] Use default config
[INFO] The "terraform" plugin block is not found. Enable the plugin "terraform" automatically
Failed to find workspaces; open .: permission denied
[INFO] Load config: .tflint.hcl
[INFO] file not found
[INFO] Load config: /home/AzDevOps/snap/tflint/52/.tflint.hcl
[INFO] file not found
[INFO] Use default config
[INFO] The "terraform" plugin block is not found. Enable the plugin "terraform" automatically

Terraform 位于模块中。main.tf 也与 tflint 处于同一级别。 tflint.hcl 也处于同一水平。

通过脚本更改权限:

chmod -R 755 $(pwd)
export TFLINT_LOG=debug
tflint --init
tflint --recursive
drwxr-xr-x 5 AzDevOps AzDevOps 4096  ..
drwxr-xr-x 4 AzDevOps AzDevOps 4096 .terraform
-rwxr-xr-x 1 AzDevOps AzDevOps 3412  .terraform.lock.hcl
-rwxr-xr-x 1 AzDevOps AzDevOps  313  .tflint.hcl
-rwxr-xr-x 1 AzDevOps AzDevOps 1973  README.md
-rwxr-xr-x 1 AzDevOps AzDevOps  400  tflint.sh
-rwxr-xr-x 1 AzDevOps AzDevOps 1022 config.tf
-rwxr-xr-x 1 AzDevOps AzDevOps  643 data.tf
-rwxr-xr-x 1 AzDevOps AzDevOps 2832 main.tf
drwxr-xr-x 6 AzDevOps AzDevOps 4096  modules
-rwxr-xr-x 1 AzDevOps AzDevOps   89  outputs.tf
-rwxr-xr-x 1 AzDevOps AzDevOps 2222  terraform.sh
-rwxr-xr-x 1 AzDevOps AzDevOps 2384  variables.tf
  It runs on self hosted devops agent
config {
  format = "compact"
  disabled_by_default = false
}

plugin "terraform" {
  enabled = true
  preset  = "recommended"
}

plugin "azurerm" {
  enabled = true
  version = "0.25.0"
  source  = "github.com/terraform-linters/tflint-ruleset-azurerm"
}

rule "terraform_required_providers" {
  enabled = false
}
azure terraform azure-pipelines terraform-provider-azure tflint
1个回答
0
投票

运行 tflint 时,您可以使用 .tflint.hcl 文件的路径指定

--config
标志。 这将确保 tflint 始终知道在哪里可以找到其配置。

tflint --init --config ./.tflint.hcl

© www.soinside.com 2019 - 2024. All rights reserved.