Skip to content

Commit

Permalink
Limit NSX Id to 1024 characters
Browse files Browse the repository at this point in the history
Excessive long URIs will not be accepted by NSX.
There should be no need to specify long NSX ids in
Terraform resources, therefore capping length to
1024 characters to avoid hitting unexpected issues
while refreshing resource state.

Signed-off-by: Salvatore Orlando <[email protected]>
  • Loading branch information
salv-orlando committed Oct 9, 2024
1 parent f8b3fd0 commit 29d7f39
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions nsxt/policy_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,26 @@ var mpObjectDataSourceDeprecationMessage = "Please use corresponding policy data

func getNsxIDSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Description: "NSX ID for this resource",
Optional: true,
Computed: true,
ForceNew: true,
Type: schema.TypeString,
Description: "NSX ID for this resource",
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: validation.StringLenBetween(1, 1024),
}
}

func getFlexNsxIDSchema(readOnly bool) *schema.Schema {
return &schema.Schema{
s := schema.Schema{
Type: schema.TypeString,
Description: "NSX ID for this resource",
Optional: !readOnly,
Computed: true,
}
if !readOnly {
s.ValidateFunc = validation.StringLenBetween(1, 1024)
}
return &s
}

func getComputedNsxIDSchema() *schema.Schema {
Expand Down

0 comments on commit 29d7f39

Please sign in to comment.