Skip to content

Commit

Permalink
Add missing deploy_hooks to vercel_project data source (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
dglsparsons committed Apr 30, 2024
1 parent 2f4fb1b commit dcbf0c1
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,22 @@ Required:

Read-Only:

- `deploy_hooks` (Attributes Set) Deploy hooks are unique URLs that allow you to trigger a deployment of a given branch. See https://vercel.com/docs/deployments/deploy-hooks for full information. (see [below for nested schema](#nestedatt--git_repository--deploy_hooks))
- `production_branch` (String) By default, every commit pushed to the main branch will trigger a Production Deployment instead of the usual Preview Deployment. You can switch to a different branch here.
- `repo` (String) The name of the git repository. For example: `vercel/next.js`.
- `type` (String) The git provider of the repository. Must be either `github`, `gitlab`, or `bitbucket`.

<a id="nestedatt--git_repository--deploy_hooks"></a>
### Nested Schema for `git_repository.deploy_hooks`

Read-Only:

- `id` (String) The ID of the deploy hook.
- `name` (String) The name of the deploy hook.
- `ref` (String) The branch or commit hash that should be deployed.
- `url` (String, Sensitive) A URL that, when a POST request is made to, will trigger a new deployment.



<a id="nestedatt--password_protection"></a>
### Nested Schema for `password_protection`
Expand Down
25 changes: 25 additions & 0 deletions vercel/data_source_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,31 @@ For more detailed information, please see the [Vercel documentation](https://ver
Description: "By default, every commit pushed to the main branch will trigger a Production Deployment instead of the usual Preview Deployment. You can switch to a different branch here.",
Computed: true,
},
"deploy_hooks": schema.SetNestedAttribute{
Description: "Deploy hooks are unique URLs that allow you to trigger a deployment of a given branch. See https://vercel.com/docs/deployments/deploy-hooks for full information.",
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The ID of the deploy hook.",
Computed: true,
},
"name": schema.StringAttribute{
Description: "The name of the deploy hook.",
Computed: true,
},
"ref": schema.StringAttribute{
Description: "The branch or commit hash that should be deployed.",
Computed: true,
},
"url": schema.StringAttribute{
Description: "A URL that, when a POST request is made to, will trigger a new deployment.",
Computed: true,
Sensitive: true,
},
},
},
},
},
},
"vercel_authentication": schema.SingleNestedAttribute{
Expand Down
12 changes: 11 additions & 1 deletion vercel/data_source_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,21 @@ resource "vercel_project" "test" {
prioritise_production_builds = true
directory_listing = true
skew_protection = "7 days"
git_repository = {
type = "github"
repo = "%[3]s"
deploy_hooks = [
{
ref = "main"
name = "some deploy hook"
}
]
}
}
data "vercel_project" "test" {
name = vercel_project.test.name
%[2]s
}
`, name, teamID)
`, name, teamID, testGithubRepo())
}

0 comments on commit dcbf0c1

Please sign in to comment.