Skip to content
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

feat: add --var-file support #3792

Merged
merged 1 commit into from Sep 1, 2022
Merged

feat: add --var-file support #3792

merged 1 commit into from Sep 1, 2022

Conversation

YairZ101
Copy link
Contributor

@YairZ101 YairZ101 commented Aug 31, 2022

What does this PR do?

This PR adds support for the --var-file flag in the new IaC testing flow.

How should this be manually tested?

  1. Build a local binary of the following snyk-iac-test branch
  2. Files to test this new functionality are available here
  3. cd to the directory linked above and run the following commands:
  4. SNYK_IAC_POLICY_ENGINE_PATH={local_snyk-iac-test_exe_path} snyk-dev iac test terraform.tf --experimental --var-file=random and get an error for non-existent vars file
  5. SNYK_IAC_POLICY_ENGINE_PATH={local_snyk-iac-test_exe_path} snyk-dev iac test terraform.tf --experimental --var-file=../valid/terraform.tf and get an error for an invalid vars file
  6. SNYK_IAC_POLICY_ENGINE_PATH={local_snyk-iac-test_exe_path} snyk-dev iac test terraform.tf --experimental --var-file=vars.tfvars and get test results

What are the relevant tickets?

https://snyksec.atlassian.net/jira/software/c/projects/CFG/boards/301?modal=detail&selectedIssue=CFG-2113

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2022

Warnings
⚠️

You've modified files in src/ directory, but haven't updated anything in test folder. Is there something that could be tested?

Generated by 🚫 dangerJS against 537372d

@YairZ101 YairZ101 force-pushed the feat/add-var-file-support branch 2 times, most recently from 4264cc0 to ee5fc6b Compare August 31, 2022 12:49
@YairZ101 YairZ101 requested a review from ipapast August 31, 2022 14:15
@YairZ101 YairZ101 marked this pull request as ready for review August 31, 2022 14:15
@YairZ101 YairZ101 requested a review from a team as a code owner August 31, 2022 14:15
Copy link
Contributor

@ipapast ipapast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested against all scenarios and also *auto.tfvars files, works great 🌟

@YairZ101 YairZ101 merged commit d2fd088 into master Sep 1, 2022
@YairZ101 YairZ101 deleted the feat/add-var-file-support branch September 1, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants