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(misconf): variable support for Terraform Plan #7228

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

nikpivkin
Copy link
Contributor

@nikpivkin nikpivkin commented Jul 25, 2024

Description

This PR adds support for input variables that are stored in Terraform Plan.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
@nikpivkin nikpivkin marked this pull request as ready for review July 25, 2024 11:36
Comment on lines +56 to +58
if len(v.Msgpack) == 0 { // len(0) because that's the default value for a "bytes" in protobuf
return nil, fmt.Errorf("dynamic value does not have msgpack serialization")
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if I understand the comment, we check the len to be zero to ensure that what we are unpacking is msgpack right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Terraforom stores cty values in msgpack encoding . If the byte length is 0, it means a invalid value is represented. I looked up the implementation in Terraform.

Comment on lines +180 to +186

for _, file := range protoFiles {
if err := sh.RunV("protoc", ".", "paths=source_relative", "--go_out", ".", "--go_opt",
"paths=source_relative", file); err != nil {
return err
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mage:protoc command builds an image and runs it. The dockerfile does not need to be updated.

@nikpivkin nikpivkin requested a review from simar7 August 7, 2024 06:01
@simar7 simar7 changed the title fix(misconf): variable support for Terraform Plan feat(misconf): variable support for Terraform Plan Aug 21, 2024
@simar7 simar7 added this pull request to the merge queue Aug 21, 2024
Merged via the queue into aquasecurity:main with commit db2c955 Aug 21, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(terraform): add variable support for Terraform Plan
2 participants