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

Allow 1d and 1w for deployment retention policy #359

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
Jul 11, 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
8 changes: 4 additions & 4 deletions docs/resources/project_deployment_retention.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ resource "vercel_project_deployment_retention" "example_customized" {

### Optional

- `expiration_canceled` (String) The retention period for canceled deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_errored` (String) The retention period for errored deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_preview` (String) The retention period for preview deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_production` (String) The retention period for production deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_canceled` (String) The retention period for canceled deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_errored` (String) The retention period for errored deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_preview` (String) The retention period for preview deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `expiration_production` (String) The retention period for production deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.
- `team_id` (String) The ID of the Vercel team.

## Import
Expand Down
16 changes: 8 additions & 8 deletions vercel/resource_project_deployment_retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,37 +66,37 @@ For more detailed information, please see the [Vercel documentation](https://ver
"expiration_preview": schema.StringAttribute{
Optional: true,
Computed: true,
Description: "The retention period for preview deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Description: "The retention period for preview deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Default: stringdefault.StaticString("unlimited"),
Validators: []validator.String{
stringvalidator.OneOf("1m", "2m", "3m", "6m", "1y", "unlimited"),
stringvalidator.OneOf("1d", "1w", "1m", "2m", "3m", "6m", "1y", "unlimited"),
},
},
"expiration_production": schema.StringAttribute{
Optional: true,
Computed: true,
Description: "The retention period for production deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Description: "The retention period for production deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Default: stringdefault.StaticString("unlimited"),
Validators: []validator.String{
stringvalidator.OneOf("1m", "2m", "3m", "6m", "1y", "unlimited"),
stringvalidator.OneOf("1d", "1w", "1m", "2m", "3m", "6m", "1y", "unlimited"),
},
},
"expiration_canceled": schema.StringAttribute{
Optional: true,
Computed: true,
Description: "The retention period for canceled deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Description: "The retention period for canceled deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Default: stringdefault.StaticString("unlimited"),
Validators: []validator.String{
stringvalidator.OneOf("1m", "2m", "3m", "6m", "1y", "unlimited"),
stringvalidator.OneOf("1d", "1w", "1m", "2m", "3m", "6m", "1y", "unlimited"),
},
},
"expiration_errored": schema.StringAttribute{
Optional: true,
Computed: true,
Description: "The retention period for errored deployments. Should be one of '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Description: "The retention period for errored deployments. Should be one of '1d', '1w', '1m', '2m', '3m', '6m', '1y', 'unlimited'.",
Default: stringdefault.StaticString("unlimited"),
Validators: []validator.String{
stringvalidator.OneOf("1m", "2m", "3m", "6m", "1y", "unlimited"),
stringvalidator.OneOf("1d", "1w", "1m", "2m", "3m", "6m", "1y", "unlimited"),
},
},
"project_id": schema.StringAttribute{
Expand Down
9 changes: 5 additions & 4 deletions vercel/resource_project_deployment_retention_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ func TestAcc_ProjectDeploymentRetention(t *testing.T) {
Config: cfg(testAccProjectDeploymentRetentionsConfig(nameSuffix, testGithubRepo(t))),
Check: resource.ComposeAggregateTestCheckFunc(
testAccProjectDeploymentRetentionExists(testClient(t), "vercel_project_deployment_retention.example", testTeam(t)),
resource.TestCheckResourceAttr("vercel_project_deployment_retention.example", "expiration_preview", "1m"),

resource.TestCheckResourceAttr("vercel_project_deployment_retention.example", "expiration_preview", "1w"),
resource.TestCheckResourceAttr("vercel_project_deployment_retention.example", "expiration_production", "2m"),
resource.TestCheckResourceAttr("vercel_project_deployment_retention.example", "expiration_canceled", "3m"),
resource.TestCheckResourceAttr("vercel_project_deployment_retention.example", "expiration_canceled", "1d"),
resource.TestCheckResourceAttr("vercel_project_deployment_retention.example", "expiration_errored", "1y"),
),
},
Expand Down Expand Up @@ -92,9 +93,9 @@ resource "vercel_project" "example" {

resource "vercel_project_deployment_retention" "example" {
project_id = vercel_project.example.id
expiration_preview = "1m"
expiration_preview = "1w"
expiration_production = "2m"
expiration_canceled = "3m"
expiration_canceled = "1d"
expiration_errored = "1y"
}
`, projectName, githubRepo)
Expand Down