Skip to content

Commit 1db186e

Browse files
committed
add provider option schema validators
1 parent 98267e3 commit 1db186e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/provider/provider.go

+9
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ import (
66
"net"
77
"net/url"
88

9+
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
910
"github.com/hashicorp/terraform-plugin-framework/datasource"
1011
"github.com/hashicorp/terraform-plugin-framework/function"
12+
"github.com/hashicorp/terraform-plugin-framework/path"
1113
"github.com/hashicorp/terraform-plugin-framework/provider"
1214
"github.com/hashicorp/terraform-plugin-framework/provider/schema"
1315
"github.com/hashicorp/terraform-plugin-framework/resource"
16+
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
1417
"github.com/hashicorp/terraform-plugin-framework/types"
1518
client "github.com/pomerium/enterprise-client-go"
1619
)
@@ -52,6 +55,12 @@ func (p *PomeriumProvider) Schema(_ context.Context, _ provider.SchemaRequest, r
5255
MarkdownDescription: "Pomerium Enterprise Service Account Token",
5356
Optional: true,
5457
Sensitive: true,
58+
Validators: []validator.String{
59+
stringvalidator.ExactlyOneOf(path.Expressions{
60+
path.MatchRoot("service_account_token"),
61+
path.MatchRoot("shared_secret_b64"),
62+
}...),
63+
},
5564
},
5665
"shared_secret_b64": schema.StringAttribute{
5766
MarkdownDescription: "Pomerium Shared Secret (base64 encoded)",

0 commit comments

Comments
 (0)