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
foreach ($folder in $foldersToCheck) {
Write-Host "Running TFLint in $folder..." $message = docker run --rm -v "$($gitRootFolder)/$($folder):/data" -v "$($env:PIPELINE_WORKSPACE)/s/Pipeline-Library/steps/tf-lint:/tflint" --entrypoint=/bin/sh ghcr.io/terraform-linters/tflint -c "tflint --init --fix --config /tflint/config.tflint.hcl";
$message
foreach ($line in $message) {
if ($line -contains "Error" -or $line -contains "Warning") {
Write-Host "##[error]TF LINT ISSUE FOUND IN $folder"
Write-Host $line -ForegroundColor DarkYellow
Write-Host "##vso[task.complete result=Failed;]"
}
}
}
Command
tflint
Terraform Configuration
# This configuration is supposed to trigger TFLINT because its missing source version. It also does not #contain the terraform version and providers.################################################################################### RESOURCES##################################################################################module"zscaler" {
#source = "app.terraform.io/REPO/COMPANY/azurerm//zscaler"#version = "2.2.13"product_name=var.product_namezpa_domain_names=var.zpa_domain_nameszpa_tcp_ports=var.zpa_tcp_portszpa_udp_ports=var.zpa_udp_ports
}
This discussion was converted from issue #1983 on February 14, 2024 04:02.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
I have the following PowerShell script running in Azure DevOps. The Azure plugin gets installed but nothing else happens.
param (
[Parameter(Mandatory = $true)][string]$targetDirectory
)
Set-Location $targetDirectory
$gitRootFolder = git rev-parse --show-toplevel
$changes = git diff --name-only 'HEAD~' 'HEAD'
$filesOfInterest = $changes | Where-Object {$_ -ilike '.tf' -or $_ -ilike '.tfvars'}
$foldersToCheck = $filesOfInterest | ForEach-Object {Split-Path $_} | Sort-Object -Unique
foreach ($folder in $foldersToCheck) {
$message = docker run --rm -v "$ ($gitRootFolder)/$ ($folder):/data" -v "$ ($env:PIPELINE_WORKSPACE)/s/Pipeline-Library/steps/tf-lint:/tflint" --entrypoint=/bin/sh ghcr.io/terraform-linters/tflint -c "tflint --init --fix --config /tflint/config.tflint.hcl";
Write-Host "Running TFLint in $folder..."
$message
foreach ($line in $message) {
if ($line -contains "Error" -or $line -contains "Warning") {
Write-Host "##[error]TF LINT ISSUE FOUND IN $folder"
Write-Host $line -ForegroundColor DarkYellow
Write-Host "##vso[task.complete result=Failed;]"
}
}
}
Command
tflint
Terraform Configuration
TFLint Configuration
Output
TFLint Version
0.50.3
Terraform Version
No response
Operating System
Beta Was this translation helpful? Give feedback.
All reactions