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

Unexpected type errors in Terraform tutorial #888

Closed
tsandall opened this issue Aug 16, 2018 · 1 comment · Fixed by #889
Closed

Unexpected type errors in Terraform tutorial #888

tsandall opened this issue Aug 16, 2018 · 1 comment · Fixed by #889
Labels

Comments

@tsandall
Copy link
Member

The policy in the Terraform tutorial is triggering incorrect type errors.

Running OPA against the first policy from the tutorial yields the following:

$ opa version
Version: 0.9.0
Build Commit: 71d0e299
Build Timestamp: 2018-08-16T00:02:29Z
Build Hostname: spacebox.local
$ opa run ~/x.rego
error: compile error: 11 errors occurred:
/Users/torin/x.rego:59: rego_type_error: match error
	left  : any<set[any], array[any]> => boolean
	right : array[any]
/Users/torin/x.rego:47: rego_type_error: match error
	left  : any<set[any], array[any]> => boolean
	right : any
/Users/torin/x.rego:48: rego_type_error: count: invalid argument(s)
	have: (any<set[any], array[any]> => boolean, ???)
	want: (any<set[any], array[any], object[any: any], string>, number)
/Users/torin/x.rego:84: rego_type_error: match error
	left  : any<set[any], array[any]> => boolean
	right : any
/Users/torin/x.rego:85: rego_type_error: undefined ref: all[_]
	all[_]
	^^^
	have: any<set[any], array[any]> => boolean
/Users/torin/x.rego:68: rego_type_error: match error
	left  : any<set[any], array[any]> => boolean
	right : any
/Users/torin/x.rego:69: rego_type_error: undefined ref: all[_]
	all[_]
	^^^
	have: any<set[any], array[any]> => boolean
/Users/torin/x.rego:76: rego_type_error: match error
	left  : any<set[any], array[any]> => boolean
	right : any
/Users/torin/x.rego:77: rego_type_error: undefined ref: all[_]
	all[_]
	^^^
	have: any<set[any], array[any]> => boolean
/Users/torin/x.rego:34: rego_type_error: match error
	left  : any<set[any], array[any]> => boolean
	right : array[number]
rego_compile_error: error limit reached
@tsandall tsandall added the bug label Aug 16, 2018
@tsandall
Copy link
Member Author

These failures are caused by the introduction of all and any built-in functions in de828cd.

@tsandall tsandall changed the title Incorrect type errors in Terraform tutorial Unexpected type errors in Terraform tutorial Aug 16, 2018
tsandall added a commit to tsandall/opa that referenced this issue Aug 16, 2018
In de828cd we added any and all built-in functions. This broke the
example policy in the terraform tutorial that was expecting "all" to be
a variable. We fix this by replacing the unification expressions ("=")
with assignments (":=").

Fixes open-policy-agent#888

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
tsandall added a commit that referenced this issue Aug 16, 2018
In de828cd we added any and all built-in functions. This broke the
example policy in the terraform tutorial that was expecting "all" to be
a variable. We fix this by replacing the unification expressions ("=")
with assignments (":=").

Fixes #888

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant