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

Add support for project fields #174

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
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
75 changes: 50 additions & 25 deletions client/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type CreateProjectRequest struct {
OutputDirectory *string `json:"outputDirectory"`
PublicSource *bool `json:"publicSource"`
RootDirectory *string `json:"rootDirectory"`
ServerlessFunctionRegion *string `json:"serverlessFunctionRegion,omitempty"`
ServerlessFunctionRegion string `json:"serverlessFunctionRegion,omitempty"`
}

// CreateProject will create a project within Vercel.
Expand Down Expand Up @@ -161,16 +161,31 @@ type ProjectResponse struct {
ProductionBranch *string `json:"productionBranch"`
DeployHooks []DeployHook `json:"deployHooks"`
} `json:"link"`
Name string `json:"name"`
OutputDirectory *string `json:"outputDirectory"`
PublicSource *bool `json:"publicSource"`
RootDirectory *string `json:"rootDirectory"`
ServerlessFunctionRegion *string `json:"serverlessFunctionRegion"`
VercelAuthentication *VercelAuthentication `json:"ssoProtection"`
PasswordProtection *PasswordProtection `json:"passwordProtection"`
TrustedIps *TrustedIps `json:"trustedIps"`
ProtectionBypass map[string]ProtectionBypass `json:"protectionBypass"`
AutoExposeSystemEnvVars *bool `json:"autoExposeSystemEnvs"`
Name string `json:"name"`
OutputDirectory *string `json:"outputDirectory"`
PublicSource *bool `json:"publicSource"`
RootDirectory *string `json:"rootDirectory"`
ServerlessFunctionRegion *string `json:"serverlessFunctionRegion"`
VercelAuthentication *VercelAuthentication `json:"ssoProtection"`
PasswordProtection *PasswordProtection `json:"passwordProtection"`
TrustedIps *TrustedIps `json:"trustedIps"`
ProtectionBypass map[string]ProtectionBypass `json:"protectionBypass"`
AutoExposeSystemEnvVars *bool `json:"autoExposeSystemEnvs"`
EnablePreviewFeedback *bool `json:"enablePreviewFeedback"`
AutoAssignCustomDomains bool `json:"autoAssignCustomDomains"`
GitLFS bool `json:"gitLFS"`
ServerlessFunctionZeroConfigFailover bool `json:"serverlessFunctionZeroConfigFailover"`
CustomerSupportCodeVisibility bool `json:"customerSupportCodeVisibility"`
GitForkProtection bool `json:"gitForkProtection"`
ProductionDeploymentsFastLane bool `json:"productionDeploymentsFastLane"`
DirectoryListing bool `json:"directoryListing"`
SkewProtectionMaxAge int `json:"skewProtectionMaxAge"`
GitComments *GitComments `json:"gitComments"`
}

type GitComments struct {
OnCommit bool `json:"onCommit"`
OnPullRequest bool `json:"onPullRequest"`
}

// GetProject retrieves information about an existing project from Vercel.
Expand Down Expand Up @@ -228,20 +243,30 @@ func (c *Client) ListProjects(ctx context.Context, teamID string) (r []ProjectRe
// - setting the field to an empty value (e.g. "") will remove the setting for that field.
// - omitting the value entirely from the request will _not_ update the field.
type UpdateProjectRequest struct {
BuildCommand *string `json:"buildCommand"`
CommandForIgnoringBuildStep *string `json:"commandForIgnoringBuildStep"`
DevCommand *string `json:"devCommand"`
Framework *string `json:"framework"`
InstallCommand *string `json:"installCommand"`
Name *string `json:"name,omitempty"`
OutputDirectory *string `json:"outputDirectory"`
PublicSource *bool `json:"publicSource"`
RootDirectory *string `json:"rootDirectory"`
ServerlessFunctionRegion *string `json:"serverlessFunctionRegion"`
VercelAuthentication *VercelAuthentication `json:"ssoProtection"`
PasswordProtection *PasswordProtectionWithPassword `json:"passwordProtection"`
TrustedIps *TrustedIps `json:"trustedIps"`
AutoExposeSystemEnvVars *bool `json:"autoExposeSystemEnvs,omitempty"`
BuildCommand *string `json:"buildCommand"`
CommandForIgnoringBuildStep *string `json:"commandForIgnoringBuildStep"`
DevCommand *string `json:"devCommand"`
Framework *string `json:"framework"`
InstallCommand *string `json:"installCommand"`
Name *string `json:"name,omitempty"`
OutputDirectory *string `json:"outputDirectory"`
PublicSource *bool `json:"publicSource"`
RootDirectory *string `json:"rootDirectory"`
ServerlessFunctionRegion string `json:"serverlessFunctionRegion,omitempty"`
VercelAuthentication *VercelAuthentication `json:"ssoProtection"`
PasswordProtection *PasswordProtectionWithPassword `json:"passwordProtection"`
TrustedIps *TrustedIps `json:"trustedIps"`
AutoExposeSystemEnvVars bool `json:"autoExposeSystemEnvs"`
EnablePreviewFeedback *bool `json:"enablePreviewFeedback"`
AutoAssignCustomDomains bool `json:"autoAssignCustomDomains"`
GitLFS bool `json:"gitLFS"`
ServerlessFunctionZeroConfigFailover bool `json:"serverlessFunctionZeroConfigFailover"`
CustomerSupportCodeVisibility bool `json:"customerSupportCodeVisibility"`
GitForkProtection bool `json:"gitForkProtection"`
ProductionDeploymentsFastLane bool `json:"productionDeploymentsFastLane"`
DirectoryListing bool `json:"directoryListing"`
SkewProtectionMaxAge int `json:"skewProtectionMaxAge"`
GitComments *GitComments `json:"gitComments"`
}

// UpdateProject updates an existing projects configuration within Vercel.
Expand Down
20 changes: 20 additions & 0 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,31 @@ output "project_id" {

### Read-Only

- `auto_assign_custom_domains` (Boolean) Automatically assign custom production domains after each Production deployment via merge to the production branch or Vercel CLI deploy with --prod. Defaults to `true`
- `automatically_expose_system_environment_variables` (Boolean) Vercel provides a set of Environment Variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed. To expose them to your Deployments, enable this field
- `build_command` (String) The build command for this project. If omitted, this value will be automatically detected.
- `customer_success_code_visibility` (Boolean) Allows Vercel Customer Support to inspect all Deployments' source code in this project to assist with debugging.
- `dev_command` (String) The dev command for this project. If omitted, this value will be automatically detected.
- `directory_listing` (Boolean) If no index file is present within a directory, the directory contents will be displayed.
- `environment` (Attributes Set) A list of environment variables that should be configured for the project. (see [below for nested schema](#nestedatt--environment))
- `framework` (String) The framework that is being used for this project. If omitted, no framework is selected.
- `function_failover` (Boolean) Automatically failover Serverless Functions to the nearest region. You can customize regions through vercel.json. A new Deployment is required for your changes to take effect.
- `git_comments` (Attributes) Configuration for Git Comments. (see [below for nested schema](#nestedatt--git_comments))
- `git_fork_protection` (Boolean) Ensures that pull requests targeting your Git repository must be authorized by a member of your Team before deploying if your Project has Environment Variables or if the pull request includes a change to vercel.json.
- `git_lfs` (Boolean) Enables Git LFS support. Git LFS replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
- `git_repository` (Attributes) The Git Repository that will be connected to the project. When this is defined, any pushes to the specified connected Git Repository will be automatically deployed. This requires the corresponding Vercel for [Github](https://vercel.com/docs/concepts/git/vercel-for-github), [Gitlab](https://vercel.com/docs/concepts/git/vercel-for-gitlab) or [Bitbucket](https://vercel.com/docs/concepts/git/vercel-for-bitbucket) plugins to be installed. (see [below for nested schema](#nestedatt--git_repository))
- `id` (String) The ID of this resource.
- `ignore_command` (String) When a commit is pushed to the Git repository that is connected with your Project, its SHA will determine if a new Build has to be issued. If the SHA was deployed before, no new Build will be issued. You can customize this behavior with a command that exits with code 1 (new Build needed) or code 0.
- `install_command` (String) The install command for this project. If omitted, this value will be automatically detected.
- `output_directory` (String) The output directory of the project. When null is used this value will be automatically detected.
- `password_protection` (Attributes) Ensures visitors of your Preview Deployments must enter a password in order to gain access. (see [below for nested schema](#nestedatt--password_protection))
- `preview_comments` (Boolean) Whether comments are enabled on your Preview Deployments.
- `prioritise_production_builds` (Boolean) If enabled, builds for the Production environment will be prioritized over Preview environments.
- `protection_bypass_for_automation` (Boolean) Allows automation services to bypass Vercel Authentication and Password Protection for both Preview and Production Deployments on this project when using an HTTP header named `x-vercel-protection-bypass`.
- `public_source` (Boolean) Specifies whether the source code and logs of the deployments for this project should be public or not.
- `root_directory` (String) The name of a directory or relative path to the source code of your project. When null is used it will default to the project root.
- `serverless_function_region` (String) The region on Vercel's network to which your Serverless Functions are deployed. It should be close to any data source your Serverless Function might depend on. A new Deployment is required for your changes to take effect. Please see [Vercel's documentation](https://vercel.com/docs/concepts/edge-network/regions) for a full list of regions.
- `skew_protection` (String) Ensures that outdated clients always fetch the correct version for a given deployment. This value defines how long Vercel keeps Skew Protection active.
- `trusted_ips` (Attributes) Ensures only visitors from an allowed IP address can access your deployment. (see [below for nested schema](#nestedatt--trusted_ips))
- `vercel_authentication` (Attributes) Ensures visitors to your Preview Deployments are logged into Vercel and have a minimum of Viewer access on your team. (see [below for nested schema](#nestedatt--vercel_authentication))

Expand All @@ -72,6 +83,15 @@ Read-Only:
- `value` (String) The value of the environment variable.


<a id="nestedatt--git_comments"></a>
### Nested Schema for `git_comments`

Required:

- `on_commit` (Boolean) Whether Commit comments are enabled
- `on_pull_request` (Boolean) Whether Pull Request comments are enabled


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

Expand Down
19 changes: 19 additions & 0 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,30 @@ resource "vercel_project" "example" {

### Optional

- `auto_assign_custom_domains` (Boolean) Automatically assign custom production domains after each Production deployment via merge to the production branch or Vercel CLI deploy with --prod. Defaults to `true`
- `automatically_expose_system_environment_variables` (Boolean) Vercel provides a set of Environment Variables that are automatically populated by the System, such as the URL of the Deployment or the name of the Git branch deployed. To expose them to your Deployments, enable this field
- `build_command` (String) The build command for this project. If omitted, this value will be automatically detected.
- `customer_success_code_visibility` (Boolean) Allows Vercel Customer Support to inspect all Deployments' source code in this project to assist with debugging.
- `dev_command` (String) The dev command for this project. If omitted, this value will be automatically detected.
- `directory_listing` (Boolean) If no index file is present within a directory, the directory contents will be displayed.
- `environment` (Attributes Set) A set of Environment Variables that should be configured for the project. (see [below for nested schema](#nestedatt--environment))
- `framework` (String) The framework that is being used for this project. If omitted, no framework is selected.
- `function_failover` (Boolean) Automatically failover Serverless Functions to the nearest region. You can customize regions through vercel.json. A new Deployment is required for your changes to take effect.
- `git_comments` (Attributes) Configuration for Git Comments. (see [below for nested schema](#nestedatt--git_comments))
- `git_fork_protection` (Boolean) Ensures that pull requests targeting your Git repository must be authorized by a member of your Team before deploying if your Project has Environment Variables or if the pull request includes a change to vercel.json. Defaults to `true`.
- `git_lfs` (Boolean) Enables Git LFS support. Git LFS replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
- `git_repository` (Attributes) The Git Repository that will be connected to the project. When this is defined, any pushes to the specified connected Git Repository will be automatically deployed. This requires the corresponding Vercel for [Github](https://vercel.com/docs/concepts/git/vercel-for-github), [Gitlab](https://vercel.com/docs/concepts/git/vercel-for-gitlab) or [Bitbucket](https://vercel.com/docs/concepts/git/vercel-for-bitbucket) plugins to be installed. (see [below for nested schema](#nestedatt--git_repository))
- `ignore_command` (String) When a commit is pushed to the Git repository that is connected with your Project, its SHA will determine if a new Build has to be issued. If the SHA was deployed before, no new Build will be issued. You can customize this behavior with a command that exits with code 1 (new Build needed) or code 0.
- `install_command` (String) The install command for this project. If omitted, this value will be automatically detected.
- `output_directory` (String) The output directory of the project. If omitted, this value will be automatically detected.
- `password_protection` (Attributes) Ensures visitors of your Preview Deployments must enter a password in order to gain access. (see [below for nested schema](#nestedatt--password_protection))
- `preview_comments` (Boolean) Whether to enable comments on your Preview Deployments. If omitted, comments are controlled at the team level (default behaviour).
- `prioritise_production_builds` (Boolean) If enabled, builds for the Production environment will be prioritized over Preview environments.
- `protection_bypass_for_automation` (Boolean) Allow automation services to bypass Vercel Authentication and Password Protection for both Preview and Production Deployments on this project when using an HTTP header named `x-vercel-protection-bypass` with a value of the `password_protection_for_automation_secret` field.
- `public_source` (Boolean) By default, visitors to the `/_logs` and `/_src` paths of your Production and Preview Deployments must log in with Vercel (requires being a member of your team) to see the Source, Logs and Deployment Status of your project. Setting `public_source` to `true` disables this behaviour, meaning the Source, Logs and Deployment Status can be publicly viewed.
- `root_directory` (String) The name of a directory or relative path to the source code of your project. If omitted, it will default to the project root.
- `serverless_function_region` (String) The region on Vercel's network to which your Serverless Functions are deployed. It should be close to any data source your Serverless Function might depend on. A new Deployment is required for your changes to take effect. Please see [Vercel's documentation](https://vercel.com/docs/concepts/edge-network/regions) for a full list of regions.
- `skew_protection` (String) Ensures that outdated clients always fetch the correct version for a given deployment. This value defines how long Vercel keeps Skew Protection active.
- `team_id` (String) The team ID to add the project to. Required when configuring a team resource if a default team has not been set in the provider.
- `trusted_ips` (Attributes) Ensures only visitors from an allowed IP address can access your deployment. (see [below for nested schema](#nestedatt--trusted_ips))
- `vercel_authentication` (Attributes) Ensures visitors to your Preview Deployments are logged into Vercel and have a minimum of Viewer access on your team. (see [below for nested schema](#nestedatt--vercel_authentication))
Expand Down Expand Up @@ -97,6 +107,15 @@ Read-Only:
- `id` (String) The ID of the Environment Variable.


<a id="nestedatt--git_comments"></a>
### Nested Schema for `git_comments`

Required:

- `on_commit` (Boolean) Whether Commit comments are enabled
- `on_pull_request` (Boolean) Whether Pull Request comments are enabled


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

Expand Down
2 changes: 1 addition & 1 deletion vercel/data_source_log_drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func responseToLogDrainWithoutSecret(ctx context.Context, out client.LogDrain) (
ID: types.StringValue(out.ID),
TeamID: toTeamID(out.TeamID),
DeliveryFormat: types.StringValue(out.DeliveryFormat),
SamplingRate: fromFloat64Pointer(out.SamplingRate),
SamplingRate: types.Float64PointerValue(out.SamplingRate),
Endpoint: types.StringValue(out.Endpoint),
Environments: environments,
Headers: headers,
Expand Down
Loading