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

Update documentation #4

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 1 commit into from
Feb 11, 2022
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
23 changes: 15 additions & 8 deletions docs/resources/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,33 @@ Once the build step has completed successfully, a new, immutable deployment will
## Example Usage

```terraform
# In this example, we are assuming that a nextjs UI
# exists in a `ui` directory alongside any terraform.
# E.g.
# ```
# ui/
# src/
# next.config.js
# // etc...
# main.tf
# ```

data "vercel_project_directory" "example" {
path = "../ui"
path = "ui"
}

data "vercel_project" "example" {
name = "my-awesome-project"
# The root directory here is also set to reflect the
# file structure.
root_directory = "ui"
}

resource "vercel_deployment" "example" {
project_id = data.vercel_project.example.id
files = data.vercel_project_directory.example.files
production = true

project_settings = {
output_directory = ".build"
build_command = "npm run build && npm run post-build"
framework = "create-react-app"
root_directory = "../ui"
}

environment = {
FOO = "bar"
}
Expand Down
14 changes: 6 additions & 8 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ deployments, you may not want to create a Project within the same terraform work
# Deployments will be created automatically
# on every branch push and merges onto the Production Branch.
resource "vercel_project" "with_git" {
name = "example-project-with-git"
framework = "create-react-app"
root_directory = "ui"
name = "example-project-with-git"
framework = "nextjs"

environment = [
{
Expand All @@ -57,15 +56,14 @@ resource "vercel_project" "with_git" {
# Deployments will need to be created manually through
# terraform, or via the vercel CLI.
resource "vercel_project" "example" {
name = "example-project"
framework = "create-react-app"
root_directory = "packages/ui"
name = "example-project"
framework = "nextjs"

environment = [
{
key = "bar"
value = "baz"
target = ["preview"]
target = ["preview", "production"]
}
]
}
Expand Down Expand Up @@ -103,7 +101,7 @@ Optional:
- **id** (String) The ID of the environment variable
- **key** (String) The name of the environment variable.
- **target** (Set of String) The environments that the environment variable should be present on. Valid targets are either `production`, `preview`, or `development`.
- **value** (String) The value of the environment variable.
- **value** (String, Sensitive) The value of the environment variable.


<a id="nestedatt--git_repository"></a>
Expand Down
7 changes: 3 additions & 4 deletions docs/resources/project_domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ By default, Project Domains will be automatically applied to any `production` de

```terraform
resource "vercel_project" "example" {
name = "example-project"
framework = "create-react-app"
name = "example-project"
}

# A simple domain that will be automatically
Expand All @@ -31,8 +30,8 @@ resource "vercel_project_domain" "example" {
domain = "i-love.vercel.app"
}

# A redirect of a domain name to another domain name,
# with optional status_code control.
# A redirect of a domain name to a second domain name.
# The status_code can optionally be controlled.
resource "vercel_project_domain" "example_redirect" {
project_id = vercel_project.example.id
domain = "i-also-love.vercel.app"
Expand Down
23 changes: 15 additions & 8 deletions examples/resources/vercel_deployment/resource.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
# In this example, we are assuming that a nextjs UI
# exists in a `ui` directory alongside any terraform.
# E.g.
# ```
# ui/
# src/
# next.config.js
# // etc...
# main.tf
# ```

data "vercel_project_directory" "example" {
path = "../ui"
path = "ui"
}

data "vercel_project" "example" {
name = "my-awesome-project"
# The root directory here is also set to reflect the
# file structure.
root_directory = "ui"
}

resource "vercel_deployment" "example" {
project_id = data.vercel_project.example.id
files = data.vercel_project_directory.example.files
production = true

project_settings = {
output_directory = ".build"
build_command = "npm run build && npm run post-build"
framework = "create-react-app"
root_directory = "../ui"
}

environment = {
FOO = "bar"
}
Expand Down
12 changes: 5 additions & 7 deletions examples/resources/vercel_project/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# Deployments will be created automatically
# on every branch push and merges onto the Production Branch.
resource "vercel_project" "with_git" {
name = "example-project-with-git"
framework = "create-react-app"
root_directory = "ui"
name = "example-project-with-git"
framework = "nextjs"

environment = [
{
Expand All @@ -24,15 +23,14 @@ resource "vercel_project" "with_git" {
# Deployments will need to be created manually through
# terraform, or via the vercel CLI.
resource "vercel_project" "example" {
name = "example-project"
framework = "create-react-app"
root_directory = "packages/ui"
name = "example-project"
framework = "nextjs"

environment = [
{
key = "bar"
value = "baz"
target = ["preview"]
target = ["preview", "production"]
}
]
}
7 changes: 3 additions & 4 deletions examples/resources/vercel_project_domain/resource.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
resource "vercel_project" "example" {
name = "example-project"
framework = "create-react-app"
name = "example-project"
}

# A simple domain that will be automatically
Expand All @@ -10,8 +9,8 @@ resource "vercel_project_domain" "example" {
domain = "i-love.vercel.app"
}

# A redirect of a domain name to another domain name,
# with optional status_code control.
# A redirect of a domain name to a second domain name.
# The status_code can optionally be controlled.
resource "vercel_project_domain" "example_redirect" {
project_id = vercel_project.example.id
domain = "i-also-love.vercel.app"
Expand Down
4 changes: 2 additions & 2 deletions vercel/data_source_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestAcc_ProjectDataSource(t *testing.T) {
resource.TestCheckResourceAttr("data.vercel_project.test", "name", name),
resource.TestCheckResourceAttr("data.vercel_project.test", "build_command", "npm run build"),
resource.TestCheckResourceAttr("data.vercel_project.test", "dev_command", "npm run serve"),
resource.TestCheckResourceAttr("data.vercel_project.test", "framework", "create-react-app"),
resource.TestCheckResourceAttr("data.vercel_project.test", "framework", "nextjs"),
resource.TestCheckResourceAttr("data.vercel_project.test", "install_command", "npm install"),
resource.TestCheckResourceAttr("data.vercel_project.test", "output_directory", ".output"),
resource.TestCheckResourceAttr("data.vercel_project.test", "public_source", "true"),
Expand All @@ -43,7 +43,7 @@ resource "vercel_project" "test" {
name = "%s"
build_command = "npm run build"
dev_command = "npm run serve"
framework = "create-react-app"
framework = "nextjs"
install_command = "npm install"
output_directory = ".output"
public_source = true
Expand Down
1 change: 0 additions & 1 deletion vercel/resource_deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestAcc_Deployment(t *testing.T) {
}

func TestAcc_DeploymentWithTeamID(t *testing.T) {
t.Parallel()
testAccDeployment(t, os.Getenv("VERCEL_TERRAFORM_TESTING_TEAM"))
}

Expand Down
4 changes: 2 additions & 2 deletions vercel/resource_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func testAccProject(t *testing.T, tid string) {
resource.TestCheckResourceAttr("vercel_project.test", "name", fmt.Sprintf("test-acc-project-%s", projectSuffix)),
resource.TestCheckResourceAttr("vercel_project.test", "build_command", "npm run build"),
resource.TestCheckResourceAttr("vercel_project.test", "dev_command", "npm run serve"),
resource.TestCheckResourceAttr("vercel_project.test", "framework", "create-react-app"),
resource.TestCheckResourceAttr("vercel_project.test", "framework", "nextjs"),
resource.TestCheckResourceAttr("vercel_project.test", "install_command", "npm install"),
resource.TestCheckResourceAttr("vercel_project.test", "output_directory", ".output"),
resource.TestCheckResourceAttr("vercel_project.test", "public_source", "true"),
Expand Down Expand Up @@ -198,7 +198,7 @@ resource "vercel_project" "test" {
%s
build_command = "npm run build"
dev_command = "npm run serve"
framework = "create-react-app"
framework = "nextjs"
install_command = "npm install"
output_directory = ".output"
public_source = true
Expand Down