Skip to content

Commit

Permalink
Merge pull request #169 from jfrog/GH-78-add-allow-download-when-unav…
Browse files Browse the repository at this point in the history
…ailable-setting

Add allow download when unavailable setting
  • Loading branch information
alexhung authored Mar 22, 2024
2 parents 8c2285a + ff35746 commit b91f699
Show file tree
Hide file tree
Showing 22 changed files with 524 additions and 248 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.4.0 (March 22, 2024). Tested on Artifactory 7.77.7 and Xray 3.91.3

IMPROVEMENTS:

* resource/xray_settings: Add attributes to support [Xray Basic settings](https://jfrog.com/help/r/jfrog-security-documentation/advanced-xray-settings). PR: [#169](https://github.com/jfrog/terraform-provider-xray/pull/169) Issue: [#78](https://github.com/jfrog/terraform-provider-xray/issues/78)

## 2.3.0 (Feburary 15, 2024). Tested on Artifactory 7.77.7 and Xray 3.91.3

IMPROVEMENTS:
Expand Down
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ fmt:
@go fmt ./...

doc:
rm docs/debug.md
go generate

.PHONY: build fmt
26 changes: 20 additions & 6 deletions docs/resources/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ subcategory: "Settings"

# xray_settings (Resource)

Provides an Xray DB Sync Time resource.
Provides an Xray resource for managing basic settings and DB Sync Time.

[API documentation](https://www.jfrog.com/confluence/display/JFROG/Xray+REST+API#XrayRESTAPI-UpdateDBSyncDailyUpdateTime).
[Settings API documentation](https://jfrog.com/help/r/xray-rest-apis/get-xray-integration-configuration).

[DB Sync Time API documentation](https://jfrog.com/help/r/xray-rest-apis/update-db-sync-daily-update-time).

## Example Usage

```terraform
resource "xray_settings" "db_sync" {
db_sync_updates_time = "18:40"
enabled = true
allow_blocked = true
allow_when_unavailable = true
block_unscanned_timeout = 120
block_unfinished_scans_timeout = 3600
db_sync_updates_time = "18:40"
}
```

Expand All @@ -24,15 +30,23 @@ resource "xray_settings" "db_sync" {

### Required

- `db_sync_updates_time` (String) The time of the Xray DB sync daily update job. Format HH:mm
- `db_sync_updates_time` (String) The time of the Xray DB sync daily update job. Format `HH:mm`

### Optional

- `allow_blocked` (Boolean) Determines whether to allow artifacts blocked by Xray to be downloaded. This setting cannot override the blocking of unscanned artifacts. Should only be set to `true` when `enabled` is set. Default value: `false`.
- `allow_when_unavailable` (Boolean) Determines whether to block certain operations (for example, downloading artifacts) when the connected Xray instance is unavailable. Should only be set to `true` when `enabled` is set. Default value: `false`.
- `block_unfinished_scans_timeout` (Number) Defines the amount of time to wait for Xray to _finish_ scanning an artifact before blocking operations on that artifact automatically if the scan is still unfinished. Default value: 1800 seconds (30 minutes)
- `block_unscanned_timeout` (Number) Defines the amount of time to wait for Xray to _start_ scanning an artifact before blocking operations on that artifact automatically if the scan has still not started. Default value: 60 seconds (1 minute)
- `enabled` (Boolean) Determines whether Xray is currently enabled. Default value: `true`.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Settings (currently only DB sync time) can be imported using their names, e.g.
Settings can be imported using the DB sync time as the ID, e.g.
```
$ terraform import xray_settings.db_sync db-time
$ terraform import xray_settings.my-settings 00:00
```
7 changes: 6 additions & 1 deletion examples/resources/xray_settings/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
resource "xray_settings" "db_sync" {
db_sync_updates_time = "18:40"
enabled = true
allow_blocked = true
allow_when_unavailable = true
block_unscanned_timeout = 120
block_unfinished_scans_timeout = 3600
db_sync_updates_time = "18:40"
}
41 changes: 21 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ module github.com/jfrog/terraform-provider-xray
// replace github.com/jfrog/terraform-provider-shared => ../terraform-provider-shared

require (
github.com/go-resty/resty/v2 v2.11.0
github.com/go-resty/resty/v2 v2.12.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/terraform-plugin-docs v0.18.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
github.com/hashicorp/terraform-plugin-testing v1.5.1
github.com/jfrog/terraform-provider-shared v1.21.3
github.com/jfrog/terraform-provider-shared v1.22.1
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819
)

Expand All @@ -19,7 +19,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
Expand All @@ -28,26 +28,26 @@ require (
github.com/fatih/color v1.16.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.5.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hc-install v0.6.2 // indirect
github.com/hashicorp/hcl/v2 v2.18.0 // indirect
github.com/hashicorp/hc-install v0.6.3 // indirect
github.com/hashicorp/hcl/v2 v2.20.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.20.0 // indirect
github.com/hashicorp/terraform-json v0.21.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-plugin-go v0.22.1 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand All @@ -64,19 +64,20 @@ require (
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/goldmark v1.6.0 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.15.0 // indirect
github.com/zclconf/go-cty v1.14.3 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.1 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/ldap.v2 v2.5.1 // indirect
Expand Down
Loading

0 comments on commit b91f699

Please sign in to comment.