Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

No support for precondition in lifecycle #1642

Open
MichalSino opened this issue Nov 14, 2023 · 1 comment
Open

No support for precondition in lifecycle #1642

MichalSino opened this issue Nov 14, 2023 · 1 comment

Comments

@MichalSino
Copy link

  • terrascan version: 1.18.3
  • Operating System: Windows

Description

When I'm trying to scan TF I got error:
Unsupported block type; Blocks of type "precondition" are not expected here

What I Did

I have different preconditions in resources and data sources and It works since terraform 1.2

lifecycle {
    precondition {
      condition     = "condition" == true
      error_message = "`condition` must be `true`."
    } }

I run command:

terrascan scan --non-recursive -i terraform -t azure  --show-passed -v
@maximveksler
Copy link

Fails inside trunk for me with the following error:

trunk_cli_version: 1.19.0
title: terrascan exited with exit_code=1
report:
  - terrascan exited with exit_code=1
  - linter:
      command: |
        /Users/maximveksler/.cache/trunk/tools/terrascan/1.18.11-6e9db740d172cf99f6895c7ca051b76b/terrascan scan -i terraform --iac-file terraform/modules/aws/s3/main.tf --output sarif
      stdin_path: (none)
      run_from: /private/var/folders/7r/1vmh1cxs2cbgm__r8cr62z0c0000gn/T/trunk-501/v1y1OR
      timeout: 10m
      rerun: (cd /private/var/folders/7r/1vmh1cxs2cbgm__r8cr62z0c0000gn/T/trunk-501/v1y1OR; env -i PATH=/Users/maximveksler/.cache/trunk/tools/terrascan/1.18.11-6e9db740d172cf99f6895c7ca051b76b:/Users/maximveksler/.cache/trunk/tools/terrascan/1.18.11-6e9db740d172cf99f6895c7ca051b76b HOME=/Users/maximveksler /Users/maximveksler/.cache/trunk/tools/terrascan/1.18.11-6e9db740d172cf99f6895c7ca051b76b/terrascan scan -i terraform --iac-file terraform/modules/aws/s3/main.tf --output sarif)
      affects_cache:
        []
      direct_configs:
        []
      exit_status: exited
      exit_code: 1
      stdout: (none)
      stderr: |
        2024-01-14T16:42:31.698+0200	�[31merror�[0m	cli/run.go:141	scan run failed{error 26 0  failed to load iac file '/private/var/folders/7r/1vmh1cxs2cbgm__r8cr62z0c0000gn/T/trunk-501/v1y1OR/terraform/modules/aws/s3/main.tf'. error:
        /private/var/folders/7r/1vmh1cxs2cbgm__r8cr62z0c0000gn/T/trunk-501/v1y1OR/terraform/modules/aws/s3/main.tf:109,5-17: Unsupported block type; Blocks of type "precondition" are not expected here.
        }

    parser: |
      (none)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants