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

Lyzohub patch 12 #40

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/sample-tf-opa-policies.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

178 changes: 178 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions always_fail/scalr-policy.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version = "v1"

policy "test_fail" {
enabled = true
enforcement_level = "soft-mandatory"
}
8 changes: 8 additions & 0 deletions always_fail/test_fail.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package terraform


deny[reason] {
true

reason := sprintf("Variables: %v",[tfplan.variables])
}
8 changes: 8 additions & 0 deletions always_pass/scalr-policy.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = "v1"



policy "test_pass" {
enabled = true
enforcement_level = "soft-mandatory"
}
9 changes: 9 additions & 0 deletions always_pass/test_pass.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package terraform


deny[reason] {
false


reason := sprintf("pass")
}
27 changes: 27 additions & 0 deletions external_data/random_decision1.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This dummy policy makes a decision based on a number received from random.org service
# just to demonstrate possible usage of HTTP requests
# to fetch external data during policy evaluation.
# See <https://www.openpolicyagent.org/docs/latest/policy-reference/#http>

package terraform


random_number = num {
request := {
"url": "https://www.random.org/integers/?num=1&min=2&max=9&base=10&col=1&format=plain",
"method": "GET"
}
response := http.send(request)
response.status_code == 200
num := to_number(trim(response.raw_body, "\n"))
}

deny[reason] {
number := random_number
number < 1

reason := sprintf(
"Unlucky you: got %d, but 5 or more is required",
[number]
)
}
28 changes: 28 additions & 0 deletions external_data/random_decision2.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This dummy policy makes a decision based on a number received from random.org service
# just to demonstrate possible usage of HTTP requests
# to fetch external data during policy evaluation.
# See <https://www.openpolicyagent.org/docs/latest/policy-reference/#http>

package terraform



random_number = num {
request := {
"url": "https://www.random.org/integers/?num=1&min=0&max=9&base=10&col=1&format=plain",
"method": "GET"
}
response := http.send(request)
response.status_code == 200
num := to_number(trim(response.raw_body, "\n"))
}

deny[reason] {
number := random_number
number < 5

reason := sprintf(
"Unlucky you: got %d, but 5 or more is required",
[number]
)
}
27 changes: 27 additions & 0 deletions external_data/random_decision3.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This dummy policy makes a decision based on a number received from random.org service
# just to demonstrate possible usage of HTTP requests
# to fetch external data during policy evaluation.
# See <https://www.openpolicyagent.org/docs/latest/policy-reference/#http>

package terraform


random_number = num {
request := {
"url": "https://www.random.org/integers/?num=1&min=0&max=9&base=10&col=1&format=plain",
"method": "GET"
}
response := http.send(request)
response.status_code == 200
num := to_number(trim(response.raw_body, "\n"))
}

deny[reason] {
number := random_number
number < 5

reason := sprintf(
"Unlucky you: got %d, but 5 or more is required",
[number]
)
}
27 changes: 27 additions & 0 deletions external_data/random_decision4.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This dummy policy makes a decision based on a number received from random.org service
# just to demonstrate possible usage of HTTP requests
# to fetch external data during policy evaluation.
# See <https://www.openpolicyagent.org/docs/latest/policy-reference/#http>

package terraform


random_number = num {
request := {
"url": "https://www.random.org/integers/?num=1&min=0&max=9&base=10&col=1&format=plain",
"method": "GET"
}
response := http.send(request)
response.status_code == 200
num := to_number(trim(response.raw_body, "\n"))
}

deny[reason] {
number := random_number
number < 5

reason := sprintf(
"Unlucky you: got %d, but 5 or more is required",
[number]
)
}
Loading
Loading