这是indexloc提供的服务,不要输入任何密码
Skip to content

Deprecate oidc_token_config.enabled field #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Optional:

Read-Only:

- `enabled` (Boolean) When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.
- `enabled` (Boolean, Deprecated) When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.


<a id="nestedatt--options_allowlist"></a>
Expand Down
5 changes: 1 addition & 4 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,9 @@ Read-Only:
<a id="nestedatt--oidc_token_config"></a>
### Nested Schema for `oidc_token_config`

Required:

- `enabled` (Boolean) When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.

Optional:

- `enabled` (Boolean, Deprecated) When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.
- `issuer_mode` (String) Configures the URL of the `iss` claim. `team` = `https://oidc.vercel.com/[team_slug]` `global` = `https://oidc.vercel.com`


Expand Down
5 changes: 3 additions & 2 deletions vercel/data_source_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ For more detailed information, please see the [Vercel documentation](https://ver
Computed: true,
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.",
Computed: true,
DeprecationMessage: "This field is deprecated and will be removed in a future version.",
Description: "When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.",
Computed: true,
},
"issuer_mode": schema.StringAttribute{
Description: "Configures the URL of the `iss` claim. `team` = `https://oidc.vercel.com/[team_slug]` `global` = `https://oidc.vercel.com`",
Expand Down
12 changes: 8 additions & 4 deletions vercel/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,12 @@ At this time you cannot use a Vercel Project resource with in-line ` + "`environ
Computed: true,
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.",
Required: true,
DeprecationMessage: "This field is deprecated and will be removed in a future version.",
Description: "When true, Vercel issued OpenID Connect (OIDC) tokens will be available on the compute environments. See https://vercel.com/docs/security/secure-backend-access/oidc for more information.",
Optional: true,
Validators: []validator.Bool{
onlyTrueValidator("This field is deprecated and can no longer be specified as 'false'"),
},
},
"issuer_mode": schema.StringAttribute{
Optional: true,
Expand All @@ -377,8 +381,8 @@ At this time you cannot use a Vercel Project resource with in-line ` + "`environ
"issuer_mode": types.StringType,
},
map[string]attr.Value{
"enabled": types.BoolValue(false),
"issuer_mode": types.StringValue("global"),
"enabled": types.BoolValue(true),
"issuer_mode": types.StringValue("team"),
},
)),
},
Expand Down
2 changes: 1 addition & 1 deletion vercel/resource_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestAcc_Project(t *testing.T) {
"key": "bar",
"value": "baz",
}),
resource.TestCheckResourceAttr("vercel_project.test", "oidc_token_config.enabled", "false"),
resource.TestCheckResourceAttr("vercel_project.test", "oidc_token_config.enabled", "true"),
resource.TestCheckResourceAttr("vercel_project.test", "preview_comments", "false"),
resource.TestCheckResourceAttr("vercel_project.test", "enable_preview_feedback", "false"),
resource.TestCheckResourceAttr("vercel_project.test", "enable_production_feedback", "true"),
Expand Down
39 changes: 39 additions & 0 deletions vercel/validator_only_true.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package vercel

import (
"context"

"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)

var _ validator.Bool = validatorOnlyTrue{}

func onlyTrueValidator(msg string) validatorOnlyTrue {
return validatorOnlyTrue{msg: msg}
}

type validatorOnlyTrue struct {
msg string
}

func (v validatorOnlyTrue) Description(ctx context.Context) string {
return "Value must be true"
}
func (v validatorOnlyTrue) MarkdownDescription(ctx context.Context) string {
return "Value must be true"
}

func (v validatorOnlyTrue) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse) {
if req.ConfigValue.IsUnknown() || req.ConfigValue.IsNull() {
return
}

if !req.ConfigValue.ValueBool() {
resp.Diagnostics.AddAttributeError(
req.Path,
"Invalid value provided",
v.msg,
)
return
}
}