-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/github_actions/crazy-max/ghaction…
…-import-gpg-6
- Loading branch information
Showing
16 changed files
with
824 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,9 @@ jobs: | |
timeout-minutes: 5 | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
@@ -25,8 +25,8 @@ jobs: | |
name: go-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
- uses: danhunsaker/[email protected] | ||
|
@@ -36,8 +36,8 @@ jobs: | |
name: go-fmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
- uses: danhunsaker/[email protected] | ||
|
@@ -47,8 +47,8 @@ jobs: | |
name: go-imports | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: check | ||
|
@@ -61,9 +61,9 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
@@ -78,11 +78,40 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
id: go | ||
- run: go test -v -cover ./internal/provider/... ./internal/client/... ./internal/config/... ./internal/utils/... | ||
codeowners: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
- name: Check for CODEOWNERS file | ||
uses: andstor/file-existence-action@v2 | ||
id: check_codeowners_1 | ||
with: | ||
files: CODEOWNERS | ||
- name: Check for CODEOWNERS file | ||
uses: andstor/file-existence-action@v2 | ||
id: check_codeowners_2 | ||
with: | ||
files: docs/CODEOWNERS | ||
- name: Check for CODEOWNERS file | ||
uses: andstor/file-existence-action@v2 | ||
id: check_codeowners_3 | ||
with: | ||
files: .github/CODEOWNERS | ||
- name: Validate CODEOWNERS | ||
uses: mszostok/[email protected] | ||
if: steps.check_codeowners_1.outputs.files_exists || steps.check_codeowners_2.outputs.files_exists ||steps.check_codeowners_3.outputs.files_exists | ||
with: | ||
checks: "files,owners,duppatterns,syntax" | ||
github_access_token: ${{ secrets.CODEOWNERS_PAT}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @axtongrams/reviewers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "wiz_report_graph_query Resource - terraform-provider-wiz" | ||
subcategory: "" | ||
description: |- | ||
A GraphQL Query Report is an automated query that can be scheduled to run at hourly intervals. | ||
--- | ||
|
||
# wiz_report_graph_query (Resource) | ||
|
||
A GraphQL Query Report is an automated query that can be scheduled to run at hourly intervals. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# A simple example | ||
resource "wiz_report_graph_query" "foo" { | ||
name = "foo" | ||
project_id = "2c38b8fa-c315-57ea-9de4-e3a19592d796" | ||
query = <<EOF | ||
{ | ||
"select": true, | ||
"type": [ | ||
"CONTAINER_IMAGE" | ||
], | ||
"where": { | ||
"name": { | ||
"CONTAINS": [ | ||
"foo" | ||
] | ||
} | ||
} | ||
} | ||
EOF | ||
} | ||
# Scheduling enabled (both run_interval_hours and run_starts_at must be set) | ||
resource "wiz_report_graph_query" "foo" { | ||
name = "foo" | ||
project_id = "2c38b8fa-c315-57ea-9de4-e3a19592d796" | ||
run_interval_hours = 24 | ||
run_starts_at = "2023-12-06 16:00:00 +0000 UTC" | ||
query = <<EOF | ||
{ | ||
"select": true, | ||
"type": [ | ||
"CONTAINER_IMAGE" | ||
], | ||
"where": { | ||
"name": { | ||
"CONTAINS": [ | ||
"foo" | ||
] | ||
} | ||
} | ||
} | ||
EOF | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) Name of the Report. | ||
- `query` (String) The query that the report will run. Required by the GRAPH_QUERY report type. | ||
|
||
### Optional | ||
|
||
- `project_id` (String) The ID of the project that this report belongs to (changing this requires re-creatting the report). Defaults to all projects. | ||
- Defaults to `*`. | ||
- `run_interval_hours` (Number) Run interval for scheduled reports (in hours). | ||
- `run_starts_at` (String) String representing the time and date when the scheduling should start (required when run_interval_hours is set). Must be in the following format: 2006-01-02 15:04:05 +0000 UTC. Also, Wiz will always round this down by the hour. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# A simple example | ||
resource "wiz_report_graph_query" "foo" { | ||
name = "foo" | ||
project_id = "2c38b8fa-c315-57ea-9de4-e3a19592d796" | ||
query = <<EOF | ||
{ | ||
"select": true, | ||
"type": [ | ||
"CONTAINER_IMAGE" | ||
], | ||
"where": { | ||
"name": { | ||
"CONTAINS": [ | ||
"foo" | ||
] | ||
} | ||
} | ||
} | ||
EOF | ||
} | ||
|
||
# Scheduling enabled (both run_interval_hours and run_starts_at must be set) | ||
resource "wiz_report_graph_query" "foo" { | ||
name = "foo" | ||
project_id = "2c38b8fa-c315-57ea-9de4-e3a19592d796" | ||
run_interval_hours = 24 | ||
run_starts_at = "2023-12-06 16:00:00 +0000 UTC" | ||
query = <<EOF | ||
{ | ||
"select": true, | ||
"type": [ | ||
"CONTAINER_IMAGE" | ||
], | ||
"where": { | ||
"name": { | ||
"CONTAINS": [ | ||
"foo" | ||
] | ||
} | ||
} | ||
} | ||
EOF | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package acceptance | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/acctest" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccResourceWizReportGraphQuery_basic(t *testing.T) { | ||
rName := acctest.RandomWithPrefix(ResourcePrefix) | ||
projectID := os.Getenv("WIZ_PROJECT_ID") | ||
|
||
resource.UnitTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t, TestCase(TcReportGraphQuery)) }, | ||
ProviderFactories: providerFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testResourceWizReportGraphQueryBasic(rName, projectID), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr( | ||
"wiz_report_graph_query.foo", | ||
"name", | ||
rName, | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_report_graph_query.foo", | ||
"project_id", | ||
projectID, | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_report_graph_query.foo", | ||
"query", | ||
"{\"select\": true, \"type\": [\"CONTAINER_IMAGE\"], \"where\": {\"name\": {\"CONTAINS\": [\"foo\"]}}}", | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_report_graph_query.foo", | ||
"run_interval_hours", | ||
"48", | ||
), | ||
resource.TestCheckResourceAttr( | ||
"wiz_report_graph_query.foo", | ||
"run_starts_at", | ||
"2023-12-06 16:00:00 +0000 UTC", | ||
), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testResourceWizReportGraphQueryBasic(rName, projectID string) string { | ||
return fmt.Sprintf(` | ||
resource "wiz_report_graph_query" "foo" { | ||
name = "%s" | ||
project_id = "%s" | ||
run_interval_hours = 48 | ||
run_starts_at = "2023-12-06 16:00:00 +0000 UTC" | ||
query = "{\"select\": true, \"type\": [\"CONTAINER_IMAGE\"], \"where\": {\"name\": {\"CONTAINS\": [\"foo\"]}}}" | ||
} | ||
`, rName, projectID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.