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

Migrate all policy resources #239

Merged
merged 11 commits into from
Sep 16, 2024
13 changes: 10 additions & 3 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,18 @@ jobs:
export WHITELIST_CIDR=$(curl -s ifconfig.me)/32
echo "WHITELIST_CIDR=$WHITELIST_CIDR" >> "$GITHUB_ENV"
echo "Creating GKE cluster ${GKE_CLUSTER} using default authentication"
gcloud container clusters create "$GKE_CLUSTER" --zone "$GKE_ZONE" \
--node-locations "$GKE_ZONE" --num-nodes "${NUM_NODES:-5}" --enable-autoscaling \
gcloud container clusters create "$GKE_CLUSTER" \
--zone "$GKE_ZONE" \
--shielded-secure-boot \
--shielded-integrity-monitoring \
--node-locations "$GKE_ZONE" \
--num-nodes "${NUM_NODES:-5}" \
--enable-autoscaling \
--machine-type "$MACHINE_TYPE" \
--disk-size 50Gi \
--min-nodes 1 --max-nodes 5 --project "$GKE_PROJECT"
--min-nodes 1 \
--max-nodes 5 \
--project "$GKE_PROJECT"
# --enable-master-authorized-networks \
# --master-authorized-networks "$WHITELIST_CIDR"
# add your NAT CIDR to whitelist local or CI/CD NAT IP. Set WHITELIST_CIDR in CI/CD to add CIDR to the list automatically.
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.11.1 (September 13, 2024). Tested on Artifactory 7.90.9 and Xray 3.104.8 with Terraform 1.9.5 and OpenTofu 1.8.2

IMPROVEMENTS:

* resource/xray_license_policy, resource/xray_operational_risk_policy, resource/xray_security_policy: Migrate from SDKv2 to Plugin Framework. PR: [#239](https://github.com/jfrog/terraform-provider-xray/pull/239)

## 2.11.0 (August 27, 2024). Tested on Artifactory 7.90.8 and Xray 3.102.5 with Terraform 1.9.5 and OpenTofu 1.8.1

IMPROVEMENTS:
Expand Down
69 changes: 59 additions & 10 deletions docs/resources/workers_count.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,22 @@ resource "xray_workers_count" "workers-count" {

### Optional

- `alert` (Block Set) The number of workers managing alerts. (see [below for nested schema](#nestedblock--alert))
- `analysis` (Block Set) The number of workers involved in scanning analysis. (see [below for nested schema](#nestedblock--analysis))
- `impact_analysis` (Block Set) The number of workers involved in Impact Analysis to determine how a component with a reported issue impacts others in the system. (see [below for nested schema](#nestedblock--impact_analysis))
- `index` (Block Set) The number of workers managing indexing of artifacts. (see [below for nested schema](#nestedblock--index))
- `migration_sbom` (Block Set) The number of workers managing SBOM migration. (see [below for nested schema](#nestedblock--migration_sbom))
- `notification` (Block Set) The number of workers managing notifications. (see [below for nested schema](#nestedblock--notification))
- `panoramic` (Block Set) The number of workers managing panoramic. (see [below for nested schema](#nestedblock--panoramic))
- `persist` (Block Set) The number of workers managing persistent storage needed to build the artifact relationship graph. (see [below for nested schema](#nestedblock--persist))
- `policy_enforcer` (Block Set) The number of workers managing policy enforcer. (see [below for nested schema](#nestedblock--policy_enforcer))
- `sbom` (Block Set) The number of workers managing SBOM. (see [below for nested schema](#nestedblock--sbom))
- `sbom_impact_analysis` (Block Set) The number of workers managing SBOM impact analysis. (see [below for nested schema](#nestedblock--sbom_impact_analysis))
- `user_catalog` (Block Set) The number of workers managing user catalog. (see [below for nested schema](#nestedblock--user_catalog))

### Read-Only

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

<a id="nestedblock--alert"></a>
### Nested Schema for `alert`

Required:

- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--analysis"></a>
### Nested Schema for `analysis`

Expand All @@ -94,6 +90,15 @@ Required:
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--migration_sbom"></a>
### Nested Schema for `migration_sbom`

Required:

- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--notification"></a>
### Nested Schema for `notification`

Expand All @@ -102,6 +107,14 @@ Required:
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--panoramic"></a>
### Nested Schema for `panoramic`

Required:

- `new_content` (Number) Number of workers for new content


<a id="nestedblock--persist"></a>
### Nested Schema for `persist`

Expand All @@ -110,6 +123,42 @@ Required:
- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--policy_enforcer"></a>
### Nested Schema for `policy_enforcer`

Required:

- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--sbom"></a>
### Nested Schema for `sbom`

Required:

- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--sbom_impact_analysis"></a>
### Nested Schema for `sbom_impact_analysis`

Required:

- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content


<a id="nestedblock--user_catalog"></a>
### Nested Schema for `user_catalog`

Required:

- `existing_content` (Number) Number of workers for existing content
- `new_content` (Number) Number of workers for new content

## Import

Workers count resource can be imported using their names, e.g.
Expand Down
2 changes: 1 addition & 1 deletion pkg/acctest/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func CreateRepos(t *testing.T, repo, repoType, projectKey, packageType string) {
}

if repoType == "remote" {
repository.Url = "http://tempurl.org"
repository.Url = "https://google.com"
}

req := restyClient.R()
Expand Down
5 changes: 4 additions & 1 deletion pkg/xray/provider/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,15 @@ func (p *XrayProvider) Configure(ctx context.Context, req provider.ConfigureRequ
// Resources satisfies the provider.Provider interface for ArtifactoryProvider.
func (p *XrayProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
xray_resource.NewBinaryManagerReposResource,
xray_resource.NewBinaryManagerBuildsResource,
xray_resource.NewBinaryManagerReposResource,
xray_resource.NewBinaryManagerReleaseBundlesV2Resource,
xray_resource.NewCustomIssueResource,
xray_resource.NewIgnoreRuleResource,
xray_resource.NewLicensePolicyResource,
xray_resource.NewOperationalRiskPolicyResource,
xray_resource.NewRepositoryConfigResource,
xray_resource.NewSecurityPolicyResource,
xray_resource.NewSettingsResource,
xray_resource.NewWatchResource,
xray_resource.NewWebhookResource,
Expand Down
3 changes: 0 additions & 3 deletions pkg/xray/provider/sdkv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ func SdkV2() *schema.Provider {
ResourcesMap: sdk.AddTelemetry(
productId,
map[string]*schema.Resource{
"xray_security_policy": xray.ResourceXraySecurityPolicyV2(),
"xray_license_policy": xray.ResourceXrayLicensePolicyV2(),
"xray_operational_risk_policy": xray.ResourceXrayOperationalRiskPolicy(),
"xray_vulnerabilities_report": xray.ResourceXrayVulnerabilitiesReport(),
"xray_licenses_report": xray.ResourceXrayLicensesReport(),
"xray_violations_report": xray.ResourceXrayViolationsReport(),
Expand Down
Loading
Loading