Skip to content

Commit

Permalink
validate project ID is UUID (#139)
Browse files Browse the repository at this point in the history
* validate project ID is UUID

* Automated docs update

---------

Co-authored-by: Dean Oren <deangili.oren@mail.schwarz>
Co-authored-by: do87 <do87@users.noreply.github.com>
  • Loading branch information
3 people authored May 12, 2023
1 parent 8945252 commit 851f9c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/resources/kubernetes_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "stackit_kubernetes_project" "example" {

### Required

- `project_id` (String) the project ID that SKE will be enabled in
- `project_id` (String) the project UUID that SKE will be enabled in

### Optional

Expand Down
7 changes: 6 additions & 1 deletion stackit/internal/resources/kubernetes/project/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import (
"fmt"

"github.com/SchwarzIT/terraform-provider-stackit/stackit/internal/common"
"github.com/SchwarzIT/terraform-provider-stackit/stackit/pkg/validate"
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)

Expand Down Expand Up @@ -38,8 +40,11 @@ func (r *Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp
},

"project_id": schema.StringAttribute{
Description: "the project ID that SKE will be enabled in",
Description: "the project UUID that SKE will be enabled in",
Required: true,
Validators: []validator.String{
validate.ProjectID(),
},
},

"timeouts": common.Timeouts(ctx, timeouts.Opts{
Expand Down

0 comments on commit 851f9c2

Please sign in to comment.