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 xray_ignore_rule to Plugin Framework #209

Merged
merged 4 commits into from
Jun 20, 2024
Merged
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.8.2 (June 19, 2024)
## 2.8.2 (June 19, 2024). Tested on Artifactory 7.84.15 and Xray 3.96.1 with Terraform 1.8.5 and OpenTofu 1.7.2

* resource/xray_custom_issue: Migrate from SDKv2 to Plugin Framework. PR: [#207](https://github.com/jfrog/terraform-provider-xray/pull/207)
* resource/xray_ignore_rule: Migrate from SDKv2 to Plugin Framework. PR: [#209](https://github.com/jfrog/terraform-provider-xray/pull/209)

## 2.8.1 (June 14, 2024). Tested on Artifactory 7.84.14 and Xray 3.96.1 with Terraform 1.8.5 and OpenTofu 1.7.2

Expand Down
5 changes: 3 additions & 2 deletions pkg/xray/provider/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ func (p *XrayProvider) Configure(ctx context.Context, req provider.ConfigureRequ

version, err := util.GetXrayVersion(restyClient)
if err != nil {
resp.Diagnostics.AddWarning(
resp.Diagnostics.AddError(
"Error getting Xray version",
fmt.Sprintf("The provider functionality might be affected by the absence of Xray version in the context. %v", err),
err.Error(),
)
return
}
Expand All @@ -187,6 +187,7 @@ func (p *XrayProvider) Resources(ctx context.Context) []func() resource.Resource
xray_resource.NewBinaryManagerReposResource,
xray_resource.NewBinaryManagerBuildsResource,
xray_resource.NewCustomIssueResource,
xray_resource.NewIgnoreRuleResource,
xray_resource.NewSettingsResource,
xray_resource.NewWebhookResource,
xray_resource.NewWorkersCountResource,
Expand Down
11 changes: 2 additions & 9 deletions pkg/xray/provider/sdkv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func SdkV2() *schema.Provider {
"xray_license_policy": xray.ResourceXrayLicensePolicyV2(),
"xray_operational_risk_policy": xray.ResourceXrayOperationalRiskPolicy(),
"xray_watch": xray.ResourceXrayWatch(),
"xray_ignore_rule": xray.ResourceXrayIgnoreRule(),
"xray_repository_config": xray.ResourceXrayRepositoryConfig(),
"xray_vulnerabilities_report": xray.ResourceXrayVulnerabilitiesReport(),
"xray_licenses_report": xray.ResourceXrayLicensesReport(),
Expand Down Expand Up @@ -122,11 +121,6 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
}
}

artifactoryVersion, err := util.GetArtifactoryVersion(restyClient)
if err != nil {
return nil, diag.FromErr(err)
}

xrayVersion, err := util.GetXrayVersion(restyClient)
if err != nil {
return nil, diag.FromErr(err)
Expand All @@ -136,9 +130,8 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer
go util.SendUsage(ctx, restyClient.R(), productId, featureUsage)

return util.ProviderMetadata{
Client: restyClient,
ArtifactoryVersion: artifactoryVersion,
XrayVersion: xrayVersion,
Client: restyClient,
XrayVersion: xrayVersion,
}, nil

}
Loading