@@ -11,11 +11,14 @@ import (
1111 ds "terraform-provider-plural/internal/datasource"
1212 r "terraform-provider-plural/internal/resource"
1313
14+ "github.com/hashicorp/terraform-plugin-framework-validators/boolvalidator"
15+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1416 "github.com/hashicorp/terraform-plugin-framework/datasource"
1517 "github.com/hashicorp/terraform-plugin-framework/path"
1618 "github.com/hashicorp/terraform-plugin-framework/provider"
1719 "github.com/hashicorp/terraform-plugin-framework/provider/schema"
1820 "github.com/hashicorp/terraform-plugin-framework/resource"
21+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
1922 "github.com/hashicorp/terraform-plugin-framework/types"
2023 client "github.com/pluralsh/console-client-go"
2124 "github.com/pluralsh/plural-cli/pkg/console"
@@ -46,15 +49,31 @@ func (p *PluralProvider) Schema(_ context.Context, _ provider.SchemaRequest, res
4649 "console_url" : schema.StringAttribute {
4750 MarkdownDescription : "Plural Console URL, i.e. `https://console.demo.onplural.sh`. Can be sourced from `PLURAL_CONSOLE_URL`." ,
4851 Optional : true ,
52+ Validators : []validator.String {
53+ stringvalidator .ConflictsWith (path .MatchRoot ("use_cli" )),
54+ stringvalidator .ExactlyOneOf (path .MatchRoot ("use_cli" )),
55+ },
4956 },
5057 "access_token" : schema.StringAttribute {
5158 MarkdownDescription : "Plural Console access token. Can be sourced from `PLURAL_ACCESS_TOKEN`." ,
5259 Optional : true ,
5360 Sensitive : true ,
61+ Validators : []validator.String {
62+ stringvalidator .ConflictsWith (path .MatchRoot ("use_cli" )),
63+ stringvalidator .ExactlyOneOf (path .MatchRoot ("use_cli" )),
64+ },
5465 },
5566 "use_cli" : schema.BoolAttribute {
5667 MarkdownDescription : "Use Plural CLI `plural cd login` command for authentication. Can be sourced from `PLURAL_USE_CLI`." ,
5768 Optional : true ,
69+ Validators : []validator.Bool {
70+ boolvalidator .ConflictsWith (
71+ path .MatchRoot ("console_url" ),
72+ path .MatchRoot ("access_token" ),
73+ ),
74+ boolvalidator .ExactlyOneOf (path .MatchRoot ("console_url" )),
75+ boolvalidator .ExactlyOneOf (path .MatchRoot ("access_token" )),
76+ },
5877 },
5978 },
6079 }
0 commit comments