Skip to content

Commit

Permalink
Task/hotfix adjust networking error handling (#248)
Browse files Browse the repository at this point in the history
* Adjust the Check how Nameservers are validated

* Add function change

---------

Co-authored-by: Robert Hoppe <robert.hoppe@mail.schwarz>
  • Loading branch information
roberth1988 and Robert Hoppe authored Jul 10, 2024
1 parent 32bb8fd commit 5ac790d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/Masterminds/semver v1.5.0
github.com/SchwarzIT/community-stackit-go-client v1.30.1
github.com/SchwarzIT/community-stackit-go-client v1.30.2
github.com/go-test/deep v1.0.3
github.com/google/uuid v1.3.0
github.com/hashicorp/terraform-plugin-framework v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugX
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
github.com/SchwarzIT/community-stackit-go-client v1.30.1 h1:pD+CvhC4qACvPboT/flp92edD/hdEPAyn02apmYXjgs=
github.com/SchwarzIT/community-stackit-go-client v1.30.1/go.mod h1:hlTfBNOKE1fokWE8g3KrI0AHo0SqzTKkS+LrIdhH8Qg=
github.com/SchwarzIT/community-stackit-go-client v1.30.2 h1:g7A1dQXb1KSiM3LTJx560bo6g1+a13++cMLOXBa8twM=
github.com/SchwarzIT/community-stackit-go-client v1.30.2/go.mod h1:hlTfBNOKE1fokWE8g3KrI0AHo0SqzTKkS+LrIdhH8Qg=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
Expand Down
4 changes: 4 additions & 0 deletions stackit/internal/resources/network/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ func (r Resource) createNetwork(ctx context.Context, resp *resource.CreateRespon
projectID, _ := uuid.Parse(plan.ProjectID.String())

res, err := r.client.IAAS.V1CreateNetwork(ctx, projectID, body)
if err != nil {
resp.Diagnostics.AddError(fmt.Sprintf("failed creating network %s", body.Name), err.Error())
return plan
}

timeout, d := plan.Timeouts.Create(ctx, 5*time.Minute)
if resp.Diagnostics.Append(d...); resp.Diagnostics.HasError() {
Expand Down
2 changes: 1 addition & 1 deletion stackit/pkg/validate/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func NameServers() *Validator {
description: "validate name servers",
validateList: func(ctx context.Context, req validator.ListRequest, resp *validator.ListResponse) {
for _, v := range req.ConfigValue.Elements() {
if err := clientValidate.NameServer(v.String()); err != nil {
if err := clientValidate.IsIP(v.String()); err != nil {
resp.Diagnostics.AddError(err.Error(), err.Error())
}
}
Expand Down

0 comments on commit 5ac790d

Please sign in to comment.