-
Notifications
You must be signed in to change notification settings - Fork 116
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
support import block for tf 1.5.0+ #1339
support import block for tf 1.5.0+ #1339
Conversation
import { | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you've added this but none of the test assertions were modified. How can we test this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the implementation code, the test will fail.
Here, as with the moved
block, this means that the import
block is not a syntax error.
Like:
# Case: Only changed test code
$ git diff origin/master
diff --git a/pkg/scanners/terraform/parser/parser_test.go b/pkg/scanners/terraform/parser/parser_test.go
index 8f693a0d..ebef5458 100644
--- a/pkg/scanners/terraform/parser/parser_test.go
+++ b/pkg/scanners/terraform/parser/parser_test.go
@@ -38,6 +38,10 @@ moved {
}
+import {
+
+}
+
resource "cats_cat" "mittens" {
name = "mittens"
special = true
$ make test
...
--- FAIL: Test_BasicParsing (0.00s)
parser_test.go:68: test.tf:19,1-7: Unsupported block type; Blocks of type "import" are not expected here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simar7 Do you mean you want more tests? (For example, for attributes in an import block)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simar7 Do you mean you want more tests? (For example, for attributes in an import block)
Yes that's right. I meant that we should test this import block functionality by having attributes in the import block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added there testing from 4ca5e4f
Just reading the release notes and it seems this feature isn't fully ready just yet?
If that's the case, I propose we should wait until they have finalized the spec for it. |
@simar7 Yes, it seems this feature isn't fully ready just yet. |
4ca5e4f
to
fa744b9
Compare
I see - that's a great point. Your suggestion makes sense to include this in. Thanks for the PR! |
Associated issue for tracking aquasecurity/trivy#4657 |
docs:
New
import
block was added from Terraform 1.5.0I added type support in a form similar to
moved
block.