Skip to content

Commit

Permalink
validate against ending slash on base_directory field in opslevel_ser…
Browse files Browse the repository at this point in the history
…vice_repository (#468)
  • Loading branch information
davidbloss authored Aug 30, 2024
1 parent f7a97dd commit 663ee0d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changes/unreleased/Bugfix-20240830-094953.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Bugfix
body: correctly reject ending slash on base_directory field in opslevel_service_repository
time: 2024-08-30T09:49:53.207297-05:00
4 changes: 2 additions & 2 deletions examples/resources/opslevel_service_repository/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ resource "opslevel_service_repository" "foo" {
repository = data.opslevel_repository.foo.id

name = "Foo"
base_directory = "example/"
base_directory = "example"
}

resource "opslevel_service_repository" "bar" {
service_alias = "bar"
repository_alias = "github.com:example/bar"

name = "Bar"
base_directory = "example/subdir/"
base_directory = "example/subdir"
}
4 changes: 2 additions & 2 deletions opslevel/resource_opslevel_service_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func (r *ServiceRepositoryResource) Schema(ctx context.Context, req resource.Sch
Optional: true,
Validators: []validator.String{
stringvalidator.RegexMatches(
regexp.MustCompile(`^[^\/].*`),
"path must not start with '/'",
regexp.MustCompile(`^[^\/].*[^\/]$`),
"path must not start or end with '/'",
),
},
},
Expand Down

0 comments on commit 663ee0d

Please sign in to comment.