Skip to content

Commit

Permalink
Merge pull request #53 from jfrog/add-version-check-for-permission-re…
Browse files Browse the repository at this point in the history
…source

Add version check for permission resource
  • Loading branch information
alexhung authored Apr 9, 2024
2 parents 4946442 + f86c26b commit a4b5c9e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/platform/resource_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"github.com/jfrog/terraform-provider-shared/util"
utilfw "github.com/jfrog/terraform-provider-shared/util/fw"
"github.com/samber/lo"
)
Expand Down Expand Up @@ -641,6 +642,18 @@ func (r *permissionResource) Configure(ctx context.Context, req resource.Configu
return
}
r.ProviderData = req.ProviderData.(PlatformProviderMetadata)

ok, err := util.CheckVersion(r.ProviderData.ArtifactoryVersion, "7.72.0")
if err != nil {
resp.Diagnostics.AddError("failed to check Artifactory version", err.Error())
}

if !ok {
resp.Diagnostics.AddError(
"Unsupported Artifactory version",
"Access Permission API is only support by Artifactory version 7.72.0 or later",
)
}
}

func (r *permissionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
Expand Down

0 comments on commit a4b5c9e

Please sign in to comment.