GithubHelp home page GithubHelp logo

vercel / terraform-provider-vercel Goto Github PK

View Code? Open in Web Editor NEW
131.0 44.0 17.0 715 KB

Terraform Vercel Provider

License: Mozilla Public License 2.0

Go 99.96% HTML 0.04%
terraform terraform-provider vercel

terraform-provider-vercel's Introduction

Vercel Terraform Provider

Requirements

  • Terraform 1.1 or higher
  • Go 1.19 (to build the provider plugin)
  • Task v3 (to run Taskfile commands)

Building The Provider

Clone repository locally and run

$ task build

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.19+ is required).

To compile the provider, run task build. This will build the provider and put the provider binary in the repository root.

$ task build

In addition, you can run task install to set up a developer overrides in your ~/.terraformrc. This will then allow you to use your locally built provider binary.

$ task install

Create a main.tf file on your machine and use the terraform cli to test

$ terraform plan
$ terraform apply

When you are finished using a local version of the provider, running task uninstall will remove all developer overrides.

$ task uninstall

Testing

In order to test the provider, you can simply run task test.

Note: This runs acceptance tests that will create real resources. You should expect that the full acceptance test suite will take some time to run.

The acceptance tests require a few environment variables to be set:

  • VERCEL_API_TOKEN - this can be generated here
  • VERCEL_TERRAFORM_TESTING_TEAM - a Vercel team_id where resources can be created and destroyed
  • VERCEL_TERRAFORM_TESTING_GITHUB_REPO - a GitHub repository in the form 'org/repo' that can be used to trigger deployments
  • VERCEL_TERRAFORM_TESTING_BITBUCKET_REPO - a Bitbucket repository in the form 'project/repo' that can be used to trigger deployments
  • VERCEL_TERRAFORM_TESTING_GITLAB_REPO - a GitLab repository in the form 'project/repo' that can be used to trigger deployments
  • VERCEL_TERRAFORM_TESTING_DOMAIN - a Vercel testing domain that can be used for testing
$ task test

In order to run the tests with extra debugging context, prefix with TF_LOG (see the terraform documentation for details).

$ TF_LOG=INFO task test

To run a specific set of tests, use the -run flag and specify a regex pattern matching the test names.

$ task test -- -run 'TestAcc_Project*'

Building The Documentation

The documentation is autogenerated from Description fields within the provider, and the examples directory. Building the documentation generates markdown in the docs folder, ready for deployment to Hashicorp.

terraform-provider-vercel's People

Contributors

anatrajkovska avatar balazs4 avatar barnabyshearer avatar chronark avatar ctgowrie avatar dglsparsons avatar ecklf avatar kitfoster avatar omercnet avatar raphaelbadia avatar switchnollie avatar wcminor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-vercel's Issues

"git_repository" can't setup project when project name not lowercase

I have problem when setup vercel using terraform.

Condition:
my repository path in gitlab user-name/repository-project and project name in gitlab Repository Project, when i'm run terraform plan its doesn't have any problem, but when run terraform apply a problem message like this:

Plan: 1 to add, 0 to change, 1 to destroy.
vercel_project.example: Destroying... [id=prj_KAhhyBtevEDJUxxxxxxx]
vercel_project.example: Destruction complete after 1s
vercel_project.example: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to vercel_project.example, provider "provider[\"registry.terraform.io/vercel/vercel\"]" produced an unexpected new value: .git_repository.repo: was
│ cty.StringVal("user-name/repository-name"), but now cty.StringVal("user-name/Repository Name").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

I think the provider doesn't support when the format path in the repository is not same as project name in the repository or format only supports lowercase without whitespace, but when I change the project name only lowercase without whitespace and same with path in the repository it works.

This is terraform configuration file:

resource "vercel_project" "example" {
  name = "project"
  framework = "nextjs"

  git_repository = {
    repo = "user-name/repository-name"
    type = "gitlab"
  }
} 

Add Deploy Hooks resource

Would be great to have a resource, or a block in the project resource, to create and manage these.

vercel_deployment does not deploy preview if production = false

Hi, I am trying to make a preview deployment in terraform, but every time it makes a production deployment

resource "vercel_project" "projname" {
  name      = "projname"
  framework = "remix"
  team_id   = "team_id"

  git_repository = {
    type = "github"
    repo = "${github_repository.projname.full_name}"
  }
}

resource "vercel_deployment" "projname_preview" {
  project_id        = vercel_project.projname.id
  team_id           = "team_id"
  ref               = "preview"
  production        = false
  delete_on_destroy = true

  environment = {
    for tuple in regexall("(.*?)=(.*)", file("./.env.prod")) : tuple[0] => tuple[1]
  }
}

I would expect when I apply this that the preview branch is deployed to a preview deployment, but my production deployment gets updated. Do I have something wrong in the syntax?

Should retry on rate limit

Hello,

We have a set of projects with a bunch of environment variables. When our CD launches a terraform plan in all our projects we hit a rate limit in the Vercel API. I think it should retry to avoid failures as hitting a rate limit is something totally avoidable. I suggest implementing an exponential retry with a big limit.

This is especially frustrating, considering we fail for milliseconds.

│ Could not get project environment variable REDACTED
│ prj_REDACTED team_REDACTED unexpected
│ error: rate_limited - Too many requests - try again in -70 ms (more than
│ 120, code: "api-projects").

Gotcha if both key and value match

Currently you get an error if you set the same key and value in two targets

resource "vercel_project" "example" {
  name = "example"
  environment = [
    {
      key = "key1"
      value = "value1"
      target = ["development"]
    },
    {
      key = "key1"
      value = "value1"
      target = ["preview"]
    }
  ]
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to vercel_project.example, provider "provider[\"registry.terraform.io/vercel/vercel\"]" produced an unexpected new value: .environment:
│ planned set element cty.ObjectVal(map[string]cty.Value{"id":cty.UnknownVal(cty.String), "key":cty.StringVal("key1"),
│ "target":cty.SetVal([]cty.Value{cty.StringVal("development")}), "value":cty.StringVal("value1")}) does not
│ correlate with any element in actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

This dose not happen if you use the same key but two different values. The preferred format and an effective solution is to share these entries between targets anyway:

resource "vercel_project" "example" {
  name = "example"
  environment = [
    {
      key = "key1"
      value = "value1"
      target = ["development", "preview"]
    }
  ]

However that can be inconvenient. For instance if value is coming from another provider you may not know ahead of time if it will be the same or different across two targets.

NS Domain Record not supported

I was able to import a NS record but when I try to run plan I get the following error.

Item must be one of MX SRV TXT A AAAA ALIAS CAA CNAME, got: NS

resource "vercel_dns_record" "domainkey" {
  domain  = "b2b.store"
  name    = "e7a7dafdhajdhd"
  type    = "NS"
  ttl     = 60
  value   = "ns.vali.email."
  team_id = "team_d7ahdhah"
}

Unexpected recreation of domain when adding env variables to vercel project

When we added a new environment variable, I saw that the project domain must be replaced. Just want to double check that this is an expected behaviour.

Terraform will perform the following actions:

  # vercel_project.web will be updated in-place
  ~ resource "vercel_project" "web" {
      + environment    = [
          + {
              + id     = (known after apply)
              + key    = "NEXT_PUBLIC_APP_CHECK_RECAPTCHAV3"
              + target = [
                  + "production",
                ]
              + value  = (sensitive value)
            }
        ]
      ~ id             = "prj_XYZ" -> (known after apply)
        name           = "web"
        # (5 unchanged attributes hidden)
    }

  # vercel_project_domain.web_dev must be replaced
-/+ resource "vercel_project_domain" "web_dev" {
      ~ id         = "id_XYZ" -> (known after apply)
      ~ project_id = "prj_XYZ" -> (known after apply) # forces replacement
        # (3 unchanged attributes hidden)
    }

Can't use "../" as root_directory

Hey!

It looks like it is not possible to use "../" as the project root directory which contradicts with the documentation at the provider's docs.

image

However, using an additional path after the upward path, e.g. "../foo" seems to work.

data "vercel_project_directory" "foo" {
  path = "../"
}

resource "vercel_deployment" "foo" {
  project_id = vercel_project.foo.id
  files      = data.vercel_project_directory.foo.files
  production = true
  project_settings = {
    root_directory = "../"
  }
}
Could not create deployment, unexpected error: invalid_root_directory - If defined, the Root
Directory must be a relative path not starting with `./` and not including `../` or other special
characters.

I often hold my terraform files in a separate folder in my repository while keeping the app at root so this is a bit problematic as I would need to change folder structure. I can work with it for now but I assume this is a bug?

CloudQuery Source Plugin?

Hi Team, hopefully this is right place to ask, if not, I'd appreciate if you can direct me.

I'm the founder of cloudquery.io, a high performance open source ELT framework.

Our users are asked for a Vercel source plugin, and we already shipped a first version.

As we have limited capacity to maintain all plugins, we are usually looking for the official vendor to help maintain it (similar to terraform provider).

I was curious if this would be an interesting collaboration, where we can help with the initial version (already implemented) and you will help maintain it?

This will give your users the ability to sync/ELT Vercel APIs to any of their datalakes/data-warehouses/databases easily using any of the growing list of CQ destination plugins.

Best,
Yevgeny

Can't setup domain for project

Hello guys, very glad that you finally created your own terraform provider ❤️
Trying to set domain for project and getting this error:

╷
│ Error: Error adding domain to project
│ 
│   with module.insurance-new.vercel_project_domain.main["texas"],
│   on modules/vercel-official/main.tf line 89, in resource "vercel_project_domain" "main":
│   89: resource "vercel_project_domain" "main" {
│ 
│ Could not add domain guychecker.com to project prj_JJHr9zb7COBo6APdLbemGopOmWwd, unexpected error: not_found - There is no project for "prj_JJHr9zb7COBo6APdLbemGopOmWwd".

Tried with your free x.vercel.app domain and also tried with one already configured in current Vercel Team even with different setup for nameservers and every time same error.

Terraform code:
Screenshot 2022-04-13 at 16 20 05

Vercel Team Settings:
Screenshot 2022-04-13 at 16 20 23

Vercel REST API implementation in Go

Hey,

Do you have plans for separating the client package to a repository of its own? It is currently the most developed Go implementation to interface with the Vercel REST API. Alternatives are chronark/vercel-go (archived in May 2022) or roll your own. I've been developing a Vault plugin for Vercel and would much rather use/extend the same API client implementation your Terraform provider does.

Thanks!

DNS record errors

Running this terraform code:

terraform {
  required_version = ">= 1.2.7"

  required_providers {
    digitalocean = {
      source  = "digitalocean/digitalocean"
      version = ">= 2.22.1"
    }
    vercel = {
      source  = "vercel/vercel"
      version = ">= 0.7.1"
    }
  }

  cloud {
    organization = "syncbase"

    workspaces {
      name = "syncbase"
    }
  }

resource "vercel_project" "frontend" {
  name      = "frontend-syncbase"
  framework = "nextjs"
}

resource "vercel_project_domain" "default" {
  project_id = vercel_project.frontend.id
  domain     = "syncbase.tv"
}

resource "vercel_dns_record" "a" {
  domain = vercel_project_domain.default.domain
  name   = ""
  type   = "A"
}

resource "vercel_dns_record" "cname" {
  domain = vercel_project_domain.default.domain
  name   = "www"
  type   = "CNAME"
  value  = vercel_project_domain.default.domain
}

Raises the following two errors:

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to vercel_dns_record.cname, provider "provider[\"registry.terraform.io/vercel/vercel\"]" produced an unexpected new value: .ttl: was null, but
│ now cty.NumberIntVal(60).
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Error creating DNS Record
│
│   with vercel_dns_record.a,
│   on main.tf line 103, in resource "vercel_dns_record" "a":
│  103: resource "vercel_dns_record" "a" {
│
│ Could not create DNS Record, unexpected error: bad_request - Invalid request: missing required property `value`.
╵

As stated in the docs:
image
Both the ttl and value option are optional so they shouldn't need be specified in the terraform configuration

Feature Request - Node Version

Hi team, it would be useful to control the node version configuration in Terraform. I just upgraded my project to V16, and would love to have the config in code

Deployment configuration files is not resolvable

Heads up: I'm not sure this is directly a terraform-provider-vercel issue, it might be on the cdktf side

I'm trying to use this provider with cdktf (using TypeScript bindings).

The provider documentation offsers as an example:

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

resource "vercel_deployment" "example" {
  // <snip>
  files = data.vercel_project_directory.example.files
  // <snip>
}

However doing the same with TypeScript is not possible because (from what I understand):

  1. the project directory data source's files map is not directly accessible and requires passing a key
  2. the deployment resource's files does not accept a cdktf.IResolvable, which would be necessary for a computed value
const projectDirectory = new DataVercelProjectDirectory(scope, 'example', {
  path: '../ui'
});
const deployment = new VercelDeployment(scope, 'example', {
  // <snip>
  files: projectDirectory.files
  // Type '(key: string) => string | IResolvable' is not assignable to type '{ [key: string]: string; }'.
  // </snip>
});

Changing git_repository in a project resource forces recreation

If you create a project:

resource "vercel_project" "example" {
  name      = "example"
  framework = "nextjs"
}

And change it to (assuming you actually have the GitHub app setup in the account)

resource "vercel_project" "example" {
  name      = "example"
  framework = "nextjs"

  git_repository = {
    type              = "github"
    repo              = "vercel/example"
    production_branch = "main"
  }
}

The provider wants to do a delete/create action, rather than an update.

Is this intended? Manually adding the GitHub app to the project and then running the terraform plan again showed that the API was able to update the project without recreation.

"vercel_project_directory" data source does not parse the path properly when deploying on Windows.

Hi,

I've been experimenting with Vercel deployments directly from the filepath in Terraform. However when deploying on a Windows OS the path and path_prefix are not interpretted correclty. As a result the deployment cannot find the right project structure during the build on Vercel and the code is "Not Found"

Steps to reproduce:

Terraform resources based on the guide on https://vercel.com/guides/integrating-terraform-with-vercel

data "vercel_project_directory" "example_mac" {
  path = "../nextjs-terraform-demo"
}

resource "vercel_project" "example_mac" {
  name = "example-mac"
  framework = "nextjs"
}

resource "vercel_deployment" "example_mac" {
  project_id = vercel_project.example_mac.id

  files = data.vercel_project_directory.example_mac.files
  path_prefix = data.vercel_project_directory.example_mac.path
}

Apply the terraform on a windows machine.

As a result the deployment has all the source files, but the files are not recognized in the Vercel Console.

Screenshot 2022-07-14 at 12 58 22

[feature] vercel_deployment data source

Hi,

I have started moving my team's existing (created by hand before my arrival for the most part) infra to Terraform recently and am encountering a blockage due to some missing data sources in this provider.

For context, I would like to manage some CNAME DNS records (directly on Cloudflare — or maybe some other provider in the future —, to avoid having to manage them on Vercel) during a dedicated run but can't seem to find a way to retrieve the generated domains assigned to various deployments (staging/development and production in this case) using data sources.

Note: I am already using vercel_deployment resources to create those deployments, but in a different run that only manages the Vercel resource. Hence the need for a data source to retrieve the info in this new run.

Is there a way to get the domain for specific deployments (ideally using a git_branch param or something like this) currently or would that be by creating this data source?

Importing Domain states with redirect

We're migrating the vercel setup to terraform. We have imported the domain states, and run into this issue when trying to apply.

│ Could not delete domain <domain> for project
│ prj_xxxxx, unexpected error: domain_is_redirect -
│ Cannot remove "<domain>" until existing redirects to
│ "<domain>" are removed.

I'm new to Vercel Terraform provider. Can you let us know what we should do?

Seeming caching issue when deploying with files

I'm not sure if there is this ability so it's more of a question, but I'm currently running into an issue where the build is seemingly cached. Since I use typescript it has old type definitions and is failing saying the type doesn't exist. With the git ref deployment I can at least trigger a new build and bust the file cache when that happens. But with the file upload it doesn't seem like that same ability exists. Is it possible a build without cache can be exposed specifically for a file upload deployment?

Please set 'Sensitive' on `environment.value`.

Thank you so much for adding a official provider. It seem to be really great.
I love that the environment variables are masked in your UI, but it would be lovely if they could be masked in the terraform logs as well. (I know they would still be in the state; but that is not exposed to our CI/CD log UI).

Optional environment variable using null value

I'd like to optionally declare an environment variable within vercel_deployment using a ternary/conditional expression by either setting a string or null.
For example:

environment = {
    MY_VAR = terraform.workspace == "default" ? "value" : null
}

This however throws an unhandled null value exception.

The only workaround right now is to instead set an empty string:

environment = {
    MY_VAR = terraform.workspace == "default" ? "value" : ""
}

I believe it would be a good addition also allow null values, and just ignore the environment entry then.

Feature: Node.js Version Declaration

Creating a Vercel project with Terraform automatically creates it with the most recent version. However, it would be ideal to be able to specify the Node.js version to make sure that it matches local development.

Proposed Definition:

resource "vercel_project" "example" {
  name         = "example-project"
  framework    = "nextjs"
  node_version = "16.x"
}

Managing environment variables for different targets separately

I have an input TF variable var.environment that I set to dev or prod. I am trying to set environment variables in vercel like so:

locals {
  vercel_environment = var.environment == "prod" ? ["production"] : ["development", "preview"]
}

resource "vercel_project_environment_variable" "aws_access_key" {
  project_id = data.vercel_project.gmn.id
  key        = "GMN_ACCESS_KEY_ID"
  value      = aws_iam_access_key.app_user.id
  target     = local.vercel_environment
}

I ran for dev and it created my env vars just fine.

Now, when I run for prod, it wants to REMOVE the development and preview targets from the environment variables.

It feels like I'm not using this resource as intended. What are some workarounds, or is this a limitation of the provider?

Proposal: support `team` as a provider configuration argument

Hi, I'm raising this here as I'd like to see if people would find this valuable

Problem

Currently, you have to pass team_id to every single resource. This is cumbersome but also leads to an easy-to-make mistake in omitting the team_id field on a resource. Sometimes the errors can be hard to track down (i.e. project not existing).

Proposal

In the same vein as AWS allowing a 'default' region to be specified for the aws provider, it would be nice to allow a team to be configured at the provider level.

This could look like the following:

provider "vercel" {
  team = "my-team" // team slug
}

and/or potentially

provider "vercel" {
  team = "team_1234abc" // team ID
}

I think in both of these cases we should be able to hook into the providers configure method to look up the ID of a team as a one-time operation. We can then reliably use a team_id from the provider, unless it is explicitly declared for a resource. This would form a preference hierarchy, with configuration on a resource being the most specific, then the provider configuration.

Usage

provider "vercel" {
  team = "my-team"
}

resource "vercel_project" "foo" {
   name = "foo" // This would be created on team my-team
}

resource "vercel_project" "bar" {
   name = "bar" 
   team_id = "team_1234abc" // this would be created on team team_1234abc
}

provider "vercel" {
   alias = "no-team" 
}

resource "vercel_project" "qux" {
  name = "qux" 
  provider = vercel.no-team // this would be created on a personal account
}

[bug] The vercel_project data source returns an error

Related to #85

The vercel_project data source returns an error in 0.11.1:

│ Error: Value Conversion Error
│ 
│   on line 1, in data "vercel_project" "example":
│    1: data "vercel_project" "example" {
│ 
│ An unexpected error was encountered trying to convert from struct value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ couldn't find type information for attribute in supplied attr.Type types.ObjectType

This is what the data source looks like:

data "vercel_project" "example" {
  name    = "example"
  team_id = var.vercel_team_id
}

My provider config:

# API token is set in the VERCEL_API_TOKEN environment variable
provider "vercel" {
  team = local.vercel_team_id
}

I tested this with 0.10.3 and it works fine.

vercel_dns_record "domain" variable handling bug, string works

Hello 👋🏼 ,

First off, thank you for providing this terraform module 😄 .

I ran into an issue with the vercel_dns_record resource, and believe it is a bug.
If there is a reason it's a feature, please let me know.

Issue

I am able to successfully create/update records on the vercel_dns_record resource when the domain variable is a hard coded string, but not when the value comes from a terraform.tfvars file (living next to the main.tf file that creates the resource) used as var.domain, etc..

Context on versions and steps to reproduce

Version 0.6.0 and loading my token from a file.

versions.tf

terraform {
  required_providers {
    vercel = {
      source = "vercel/vercel"
      version = "0.6.0"
    }
  }
}

provider "vercel" {
  # https://vercel.com/account/tokens
  api_token = yamldecode(file("~/.config/tokens/vercel.yaml"))["token"]
}

I've confirmed that I have the 3rd party domain setup in Vercel. The bug/issue isn't related to that initial creation of the domain, but rather variable inputs to the vercel_dns_record resource.

terraform.tfvars contains a variable for the domain I'm looking to add records to.

domain = "iancleary.me"
host   = "box"

Main terraform file declaring resource:

resource "vercel_dns_record" "mx" {
  domain = var.domain
  type   = "MX"
  ttl    = 60
  value  = format("%s.%s",var.host,var.domain)
  name   = ""
  mx_priority = 10
}

run plan and encounter error

command

terraform plan

output

╷
│ Error: Value Conversion Error
│
│   with module.mail_in_a_box_dns.vercel_dns_record.mx,
│   on modules\mail-in-a-box-dns\main.tf line 2, in resource "vercel_dns_record" "mx":2:   domain = var.domain
│
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report    
│ the following to the provider developer:
│
│ unhandled unknown value

What does work

resource "vercel_dns_record" "mx" {
  domain = "iancleary.me"
  type   = "MX"
  ttl    = 60
  value  = "box.iancleary.me"
  name   = ""
  mx_priority = 10
}

What did I expect to happen

I was expecting the vercel_dns_record resource to handle variables being provided as inputs, but unhandled unknown value is written to the console. Given the prompt from terraform to report the bug, this issue aims to do that, providing you the information necessary to reproduce.

Please let me know if you need any other information from me.

Thanks!

PNG images in the public folder become corrupt when uploaded via provider

Hi,

PNG images in the public folder are being corrupted during an upload via the Terraform provider.
They are not visible in the Vercel console, and do not render properly in the browser either.

Steps to reproduce:

  • Add png to public folder
  • Deploy to Vercel via Terraform.

See image of faulty png in the Vercel console.
image

Kind regards, Tom

Error: Provider produced inconsistent result after apply

Hi,

When trying to perform a terraform apply with a new Vercel Project with public_source = false, I got the following error:
Screen Shot 2022-08-22 at 14 03 00

Below is the resource that was attempted to be created (environment has a list of vars not included):

resource "vercel_project" "ecom-storefront" {
  name      = "ecom-storefront-1"
  framework = "nextjs"
  git_repository = {
    type = "github"
    repo = "a-github-repo"
  }
  team_id                    = "a-team-id"
  serverless_function_region = "iad1"
  install_command            = "npm install -g npm-cli-login && npm-cli-login && npm install"
  public_source              = false
  environment = []
}

Steps Taken to Debug:

  1. Verify terraform fmt -check
  2. Verify terraform validate
  3. Verify latest Provider version (using ~> 0.7)
  4. Retry terraform apply (destroy works as expected, creation fails again)

Details from terraform version:

Terraform v1.2.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.27.0
+ provider registry.terraform.io/vercel/vercel v0.7.0

[Feature Request] Add Ignore Build resource

It would be awesome to have a resource that lets users configure which git branches they want ignored in Vercel's build process.

It's possible to do this manually, however it would be really cool if this process could be done in the config. I feel like this would really help improve workflows for projects.

Allow setting SSO and password protection

There's no way to set up SSO or password protection at this moment, which would be quite helpful because that's something I have to change manually.

Is there any chance you can add it?

image

image

terraform plan results in terraform-provider-vercel_v0.10.1 plugin panic

OS: Mac OS 12.5.1 (21G83) on ARM64
Terraform: v1.1.4 on darwin_arm64

Repro:

  • Copy attached repro.tf.txt into a folder, and rename to repro.tf
  • Change the git_repository config to something useful
  • terraform init
  • Set an API token with access to your Vercel team
  • Have your Team ID ready for pasting
  • terraform plan

Observed:
Crash

Output:

Stack trace from the terraform-provider-vercel_v0.10.1 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x1055442a0]

goroutine 31 [running]:
github.com/vercel/terraform-provider-vercel/client.(*Client).GetTeam(0x0, {0x1057f63e0, 0x14000282e40}, {0x1400019e420, 0x1d})
	github.com/vercel/terraform-provider-vercel/client/team_get.go:13 +0x50
github.com/vercel/terraform-provider-vercel/vercel.(*vercelProvider).Configure(0x14000120878, {0x1057f63e0, 0x14000282e40}, {{0x140000383f8, 0x5}, {{{0x1057fa008, 0x14000283410}, {0x1057206e0, 0x140002831a0}}, {0x1400049b470, ...}}}, ...)
	github.com/vercel/terraform-provider-vercel/vercel/provider.go:130 +0x274
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ConfigureProvider(0x1400017bce0, {0x1057f63e0, 0x14000282e40}, 0x140002a7400, 0x14000046ac0)
	github.com/hashicorp/[email protected]/internal/fwserver/server_configureprovider.go:15 +0xc4
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ConfigureProvider(0x1400017bce0, {0x1057f63e0?, 0x14000282cf0?}, 0x5?)
	github.com/hashicorp/[email protected]/internal/proto6server/server_configureprovider.go:36 +0x220
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ConfigureProvider(0x14000392500, {0x1057f63e0?, 0x140002823c0?}, 0x14000046880)
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:527 +0x250
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ConfigureProvider_Handler({0x1057c9280?, 0x14000392500}, {0x1057f63e0, 0x140002823c0}, 0x140000a4460, 0x0)
	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:331 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x140003061e0, {0x1057fa2f8, 0x1400029c4e0}, 0x14000000c60, 0x140003d7d10, 0x105c1ab98, 0x0)
	google.golang.org/[email protected]/server.go:1301 +0x9c4
google.golang.org/grpc.(*Server).handleStream(0x140003061e0, {0x1057fa2f8, 0x1400029c4e0}, 0x14000000c60, 0x0)
	google.golang.org/[email protected]/server.go:1642 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:938 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:936 +0x290

Error: The terraform-provider-vercel_v0.10.1 plugin crashed!

repro.tf.txt

[Feature Request] Allow the vercel_project_domain resource to output the required IP and CNAME addresses

As mentioned in the title, I'd really love to be able to use vercel and google managed zones together.
I'm currently doing it manually, however it would be really awesome if the vercel_project_domain could output the required targets.

This would automate a little more of my workflow, what is currently hardcoded:

Note that I haven't even worked out how to add the IP address which can potentially change based on the domain?

resource "google_dns_record_set" "app" {
  name = data.google_dns_managed_zone.app.dns_name
  type = "CNAME"
  ttl  = 300

  managed_zone = data.google_dns_managed_zone.app.name

  rrdatas = ["cname.vercel-dns.com"]
}

could become

resource "vercel_project_domain" "app" {
  project_id = data.vercel_project.app.id
  domain     = data.google_dns_managed_zone.app.dns_name
  git_branch = var.env_git_branch
}

resource "google_dns_record_set" "cname" {
  name = data.google_dns_managed_zone.app.dns_name
  type = "CNAME"
  ttl  = 300

  managed_zone = data.google_dns_managed_zone.app.name

  rrdatas = [vercel_project_domain.app.cname.target]
}

resource "google_dns_record_set" "a" {
  name = data.google_dns_managed_zone.app.dns_name
  type = "A"
  ttl  = 300

  managed_zone = data.google_dns_managed_zone.app.name

  rrdatas = [vercel_project_domain.app.a.target]
}

Error: Error adding domain to project

Issue 1

According to the Provider Docs, the team_id is an optional field for the vercel_project_domain resource. However, not including the field results in a mismatch with used team_ids. The Provider attempts to use your personal team_id instead of the team_id associated with the vercel_project_domain's vercel_project.

Screenshot:
Screen Shot 2022-08-24 at 10 58 26

Code for vercel_project_domain:

resource "vercel_project" "ecom-storefront" {
  name      = "ecom-storefront-1"
  framework = "nextjs"
  git_repository = {
    type = "github"
    repo = "a-github-repo"
  }
  team_id                    = "a-team-id"
  serverless_function_region = "iad1"
  install_command            = "npm install -g npm-cli-login && npm-cli-login && npm install"
  public_source              = false
  environment = []
}

resource "vercel_project_domain" "production-domain" {
  project_id = vercel_project.ecom-storefront.id
  domain     = "ecom-storefront-1.vercel.app"
}

# Define the staging domain (pre-production testing)
resource "vercel_project_domain" "staging-domain" {
  project_id = vercel_project.ecom-storefront.id
  domain     = "ecom-storefront-staging-1.vercel.app"
  git_branch = "dev"
}

Steps Taken to Debug:

  1. Verify terraform fmt -check
  2. Verify terraform validate
  3. Verify latest Provider version (using ~> 0.7.1)

Details from terraform version:

Terraform v1.2.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.27.0
+ provider registry.terraform.io/vercel/vercel v0.7.1

Issue 2

Ideally, vercel_project_domain resources should be able to be specified, even if they are implied Vercel defaults. Adding a vercel_project_domain that has a domain that matches its associated vercel_project.name triggers an error that the domain already belongs to a "different project", even though the error's "project_id" matches the desired vercel_project.

Screenshot:
Screen Shot 2022-08-24 at 11 12 14

Code for vercel_project_domain:

resource "vercel_project" "ecom-storefront" {
  name      = "ecom-storefront-1"
  framework = "nextjs"
  git_repository = {
    type = "github"
    repo = "a-github-repo"
  }
  team_id                    = "a-team-id"
  serverless_function_region = "iad1"
  install_command            = "npm install -g npm-cli-login && npm-cli-login && npm install"
  public_source              = false
  environment = []
}

resource "vercel_project_domain" "production-domain" {
  project_id = vercel_project.ecom-storefront.id
  team_id    = "a-team-id"
  domain     = "ecom-storefront-1.vercel.app"
}

Steps Taken to Debug:

  1. Verify terraform fmt -check
  2. Verify terraform validate
  3. Verify latest Provider version (using ~> 0.7.1)

Details from terraform version:

Terraform v1.2.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.27.0
+ provider registry.terraform.io/vercel/vercel v0.7.1

Import multiple vercel projects that target the same repo

👋 Hi,

I'm using Terraform v1.2.1 on Mac.

I'm currently trying to setup a Terraform config for two existing projects that rely on the same repository.

Step to reproduce :

  • I run terraform import prj_xxxxxxxxxxxxxxxxxxxxxxxxxxxx for the first one, everything is ok.
  • I run terraform import prj_xxxxxxxxxxxxxxxxxxxxxxzzzzzz for the second app

I get the following error

Error: Resource already managed by Terraform
Terraform is already managing a remote object for vercel_project.lagora. To
import to this address you must first remove the existing object from the
state.

The tfstate looks like that.

# terraform.tfstate
{
  "version": 4,
  "terraform_version": "1.2.1",
  "serial": 1,
  "lineage": "7322539c-148b-3917-57d5-22346ea17bd6",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "vercel_project",
      "name": "my-project",
      "provider": "provider[\"registry.terraform.io/vercel/vercel\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "build_command": null,
            "dev_command": null,
            "environment": null,
            "framework": null,
            "git_repository": {
              "repo": "jean-smaug/my-project",
              "type": "github"
            },
            "install_command": null,
            "name": "my-project-service",
            "output_directory": null,
            "public_source": null,
            "root_directory": "services/foo",
            "team_id": null
          },
          "sensitive_attributes": []
        }
      ]
    }
  ]
}

It seems I can't add a new instance.

Cannot create file deployment on non personal project due to unauthorized message

Followed the steps here to create a token scoped to my org:
https://vercel.com/support/articles/how-do-i-use-a-vercel-api-access-token#how-to-create-the-token
I've verified my local's have the values required. Is there an additional step I'm missing?

Placed token in the provider block:

provider "vercel" {
  api_token = "..."
}
data "vercel_project_directory" "files" {
  path = "../"
}

data "vercel_project" "project" {
  team_id = local.team_id
  name    = local.project_name
}

resource "vercel_deployment" "project" {
#  team_id        = local.team_id # doesn't matter if I specify this
  project_id     = data.vercel_project.project.id
  files          = data.vercel_project_directory.files.files
  path_prefix  = data.vercel_project_directory.files.path
  production  = false
}

Error Message

For some reason it's trying to deploy to my personal account rather than respecting the team_id. Looking through the trace logs it looks like it might not be adding the teamId to the create deployment request.

Could not upload deployment file ../pages/Users.ts, unexpected error: forbidden - Not authorized: Authorization is missing access to scope "rizowski". You must re-authenticate to this scope or use a token with access to this scope.

Additional info

Provider Version : ~> 0.4 installed v0.5.0
terraform version: `1.2.2

I know it can fetch projects from the right team, since I'm using that above. It's just not allowing deployments.

SHA1 Mismatch

Hello,

I'm trying to use the provider to deploy an app within a monorepo (turborepo).

Whenever I try to deploy I get into SHA1 mismatches and I can't figure how nor why as there are no reason that the files taken from data.vercel_project_directory would change during the terraform run:

data "vercel_project_directory" "project" {
  path = "${path.root}/../../../../app/browser"
}

resource "vercel_project" "project" {
  name      = "awesome"
  framework = "nextjs"
  serverless_function_region = "cdg1"

  environment = []

  # https://vercel.com/docs/concepts/monorepos/turborepo
  build_command = "cd ../.. && npx turbo run build --filter=browser"
  root_directory = "app/browser"
}

resource "vercel_deployment" "project" {
  project_id    = vercel_project.project.id
  files              = data.vercel_project_directory.project.files
  path_prefix = 
  production  = true
}

And then I get:

Error: Error uploading deployment file
[1266](?check_suite_focus=true#step:13:1267)
│ 
[1267](?check_suite_focus=true#step:13:1268)
│   with module.platform.module.dashboard.vercel_deployment.project,
[1268](?check_suite_focus=true#step:13:1269)
│   on ../../recipes/vercel/main.tf line 16, in resource "vercel_deployment" "project":
[1269](?check_suite_focus=true#step:13:1270)
│   16: resource "vercel_deployment" "project" {
[1270](?check_suite_focus=true#step:13:1271)
│ 
[1271](?check_suite_focus=true#step:13:1272)
│ Could not upload deployment file
[1272](?check_suite_focus=true#step:13:1273)
│ ../../../../app/browser/packages/assets/images/bluetooth.svg, unexpected
[1273](?check_suite_focus=true#step:13:1274)
│ error: sha1sum_mismatch - SHA1 sum of the file
[1274](?check_suite_focus=true#step:13:1275)
│ (9bbe672f3b95401c035390bae38639915358c4f9) doesn't match the provided SHA1
[1275](?check_suite_focus=true#step:13:1276)
│ sum (296a875c1282c3f01a361f5f075faf99657d17e4)

I'm using version 0.6.2 of the provider and terraform 1.2.6, and it runs on GitHub actions.

vercel provider panics on plan or apply

vercel provider panics on plan or apply

$ terraform plan

...

module.app-www.vercel_project.www: Refreshing state... [id=prj_xxxxxxxxxxxxxxxxxxxxxxxx]
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).PlanResourceChange call. The plugin logs may
│ contain more details.
╵

Stack trace from the terraform-provider-vercel_v0.2.2 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x5a151d]

goroutine 75 [running]:
github.com/hashicorp/terraform-plugin-framework/types.SetType.Validate({{0xb58ba0, 0xc000453860}}, {0xc000232e58, 0xc000658368}, {{0x0, 0x0}, {0x0, 0x0}}, 0xc0006630c0)
        github.com/hashicorp/[email protected]/types/set.go:118 +0xbd
github.com/hashicorp/terraform-plugin-framework/tfsdk.State.getAttributeValue({{{0xb72370, 0xc000700c30}, {0x9d44e0, 0xc000202810}}, {0xc000554a50, 0x0, 0x0, {0x0, 0x0}, {0xab4ba2, ...}, ...}}, ...)
        github.com/hashicorp/[email protected]/tfsdk/state.go:95 +0x297
github.com/hashicorp/terraform-plugin-framework/tfsdk.Attribute.modifyPlan({{0xb6e3f8, 0xc0006630c0}, {0x0, 0x0}, {0xab0dda, 0x88}, {0x0, 0x0}, 0x1, 0x0, ...}, ...)
        github.com/hashicorp/[email protected]/tfsdk/attribute.go:491 +0x168
github.com/hashicorp/terraform-plugin-framework/tfsdk.Attribute.modifyPlan({{0x0, 0x0}, {0xb74df0, 0xc00000c8b8}, {0xaad96a, 0x4a}, {0x0, 0x0}, 0x0, 0x1, ...}, ...)
        github.com/hashicorp/[email protected]/tfsdk/attribute.go:569 +0x19e8
github.com/hashicorp/terraform-plugin-framework/tfsdk.Schema.modifyPlan({_, _, _, {_, _}, {_, _}, {_, _}}, {0xb692d8, ...}, ...)
        github.com/hashicorp/[email protected]/tfsdk/schema.go:321 +0x250
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).planResourceChange(0xc0003c5a70, {0xb692d8, 0xc00004e7c0}, 0xc00013a7d0, 0xc00065ba10)
        github.com/hashicorp/[email protected]/tfsdk/serve.go:810 +0xe0e
github.com/hashicorp/terraform-plugin-framework/tfsdk.(*server).PlanResourceChange(0xb692d8, {0xb692d8, 0xc00004e700}, 0x5)
        github.com/hashicorp/[email protected]/tfsdk/serve.go:635 +0x90
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).PlanResourceChange(0xc00030e600, {0xb69380, 0xc000554300}, 0xc0002560e0)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:579 +0x30e
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_PlanResourceChange_Handler({0xa663c0, 0xc00030e600}, {0xb69380, 0xc000554300}, 0xc0005822a0, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:363 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00036c8c0, {0xb74ea0, 0xc0001e2820}, 0xc000584000, 0xc0003c5bc0, 0xf7c1a8, 0x0)
        google.golang.org/[email protected]/server.go:1282 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc00036c8c0, {0xb74ea0, 0xc0001e2820}, 0xc000584000, 0x0)
        google.golang.org/[email protected]/server.go:1616 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:921 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:919 +0x294

Error: The terraform-provider-vercel_v0.2.2 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

ERRO[0014] 1 error occurred:
        * exit status 1
          
make: *** [Makefile:43: plan] Error 1

Error: Invalid value provided for vercel_project_environment_variable when using a variable for target

When trying to apply changes to a vercel_project_environment_variable resource, I'm getting the following error:

│ Error: Invalid value provided
│ 
│   with module.example.vercel_project_environment_variable.foo,
│   on ./vercel.tf line 84, in resource "vercel_project_environment_variable" "foo":
│   84:   target     = [var.vercel_target]
│ 
│ Set item must be one of production, preview, development, got 

This breaks for me in version 0.12 and 0.13, but the same resource declaration works in version 0.11.5. This issue only occurs when using a variable for the target, literal strings work fine.

Support managing environment variables separately

Hi,

I wondered if we'd eventually get a resource that allows us to manage environment variables entirely separately from the vercel_project resource.

I have multiple environments/terraform directories that look something like this:

terraform/
├─ environments/
│  ├─ root/
│  │  ├─ main.tf
│  │  ├─ (Houses root vercel project)
│  │  ├─ (Houses overall DNS zones)
│  │  ├─ (Creates separate aws accounts listed below)
│  ├─ production/
│  │  ├─ main.tf
│  │  ├─ (Contains env specific resources such as DBs, APIs, etc...)
│  ├─ staging/
│  │  ├─ main.tf
│  │  ├─ (Contains env specific resources such as DBs, APIs, etc...)

Now those environment specific resources keys, urls and secrets are not accessible to the root account and I'd like to be able to manage those env vars in the individual terraform environments.

I've noticed that the chonark vercel package terraform does have this, but it's not maintained anymore.

project_environment_variable values should be sensitive

Hi,

I've started to use your provider earlier today and I'm having a few issues and questions.

My main issue is the difference of behavior between the vercel_project.environment block and the vercel_project_environment_variable resource: the first one marks all values as sensitive (which is good for security) but the later doesn't so I risk having values being output when I don't want them displayed.

I also find weird having to specify an id is the vercel_project.environment blocks, but I won't be using them as I much prefer having dedicated resources anyway.

Also, now that this new vercel_project_environment_variable resource exists, not specifying the environment property in a vercel_project shouldn't cause an update of the resource if I never had it specified before: this makes me think that every time I'll update a project property I risk breaking all my env vars and having to re-import them via the vercel_project_environment_variable resources, which I define in different TF runs (kind of like the architecture in #47).


Update: I tried applying the changes on my project and it did break all the env vars (including those that were defined in the same run using vercel_project_environment_variable resources) as I had feared… I had to re-add all of them.
This is not OK for a stable deployment process!

Creating Project Fails

Hey 👋🏻 I'm trying to deploy to vercel via GHA. I'm looking for some guidance into what I'm doing wrong.

My main.tf looks like:

terraform {
  required_providers {
    vercel = {
      source  = "vercel/vercel"
      version = "~> 0.15"
    }
  }
  required_version = "1.5.3"
}

provider "vercel" {
  api_token = var.vercel_api_token
}

resource "vercel_project" "dev" {
  name      = "nexushunter"
  framework = "nextjs"

  git_repository = {
    type              = "github"
    production_branch = "main"
    repo              = "Nexushunter/nexushunterdev"
  }
  serverless_function_region = "iad1"
}

resource "vercel_project_domain" "dev" {
  project_id = vercel_project.dev.id
  git_branch = var.branch_name
  domain     = "staging.nexushunter.dev"
}

Variables file:

# Set in GHA env
variable "vercel_api_token" {
  type        = string
  description = "Vercel Api Token"
}

variable "vercel_project_id" {
  type        = string
  description = "Vercel Project Id"
}

variable "branch_name" {
  type        = string
  description = "Development Branch Name"
  default     = null 
}

Trace logs:

vercel_project.dev: Creating...
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Received request: tf_proto_version=6.3 tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_provider_addr=registry.terraform.io/vercel/vercel tf_resource_type=vercel_project tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:806 @module=sdk.proto timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Sending request downstream: tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_resource_type=vercel_project tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/tfprotov6/internal/tf6serverlogging/downstream_request.go:20 @module=sdk.proto tf_proto_version=6.3 tf_provider_addr=registry.terraform.io/vercel/vercel timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Checking ResourceTypes lock: @module=sdk.framework tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_rpc=ApplyResourceChange tf_resource_type=vercel_project @caller=github.com/hashicorp/[email protected]/internal/fwserver/server.go:342 tf_provider_addr=registry.terraform.io/vercel/vercel timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Checking ResourceSchemas lock: tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c @caller=github.com/hashicorp/[email protected]/internal/fwserver/server.go:416 tf_provider_addr=registry.terraform.io/vercel/vercel tf_resource_type=vercel_project tf_rpc=ApplyResourceChange @module=sdk.framework timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: ApplyResourceChange received no PriorState, running CreateResource: tf_provider_addr=registry.terraform.io/vercel/vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_resource_type=vercel_project @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_applyresourcechange.go:45 @module=sdk.framework tf_rpc=ApplyResourceChange timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Resource implements ResourceWithConfigure: tf_provider_addr=registry.terraform.io/vercel/vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:47 @module=sdk.framework tf_resource_type=vercel_project timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [DEBUG] provider.terraform-provider-vercel_v0.15.0: Calling provider defined Resource Configure: tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:54 @module=sdk.framework tf_provider_addr=registry.terraform.io/vercel/vercel tf_resource_type=vercel_project timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [DEBUG] provider.terraform-provider-vercel_v0.15.0: Called provider defined Resource Configure: tf_rpc=ApplyResourceChange tf_provider_addr=registry.terraform.io/vercel/vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_resource_type=vercel_project @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:56 @module=sdk.framework timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [DEBUG] provider.terraform-provider-vercel_v0.15.0: Calling provider defined Resource Create: @module=sdk.framework tf_resource_type=vercel_project tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:100 tf_provider_addr=registry.terraform.io/vercel/vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.340Z [TRACE] provider.terraform-provider-vercel_v0.15.0: creating project: payload={"buildCommand":null,"devCommand":null,"environmentVariables":[],"framework":"nextjs","gitRepository":{"type":"github","repo":"Nexushunter/nexushunterdev"},"installCommand":null,"name":"nexushunterdev","outputDirectory":null,"publicSource":null,"rootDirectory":null,"serverlessFunctionRegion":"iad1"} tf_provider_addr=registry.terraform.io/vercel/vercel tf_resource_type=vercel_project tf_rpc=ApplyResourceChange url=https://api.vercel.com/v8/projects @caller=github.com/vercel/terraform-provider-vercel/client/project_create.go:53 @module=vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c timestamp=2023-08-01T02:34:28.340Z
2023-08-01T02:34:28.897Z [DEBUG] provider.terraform-provider-vercel_v0.15.0: Called provider defined Resource Create: tf_provider_addr=registry.terraform.io/vercel/vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:102 @module=sdk.framework tf_resource_type=vercel_project timestamp=2023-08-01T02:34:28.897Z
2023-08-01T02:34:28.898Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Received downstream response: diagnostic_error_count=1 tf_req_duration_ms=557 tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c diagnostic_warning_count=0 tf_proto_version=6.3 tf_provider_addr=registry.terraform.io/vercel/vercel tf_resource_type=vercel_project @caller=github.com/hashicorp/[email protected]/tfprotov6/internal/tf6serverlogging/downstream_request.go:40 @module=sdk.proto tf_rpc=ApplyResourceChange timestamp=2023-08-01T02:34:28.897Z
Error: -01T02:34:28.898Z [ERROR] provider.terraform-provider-vercel_v0.15.0: Response contains error diagnostic: diagnostic_summary="Error creating project" tf_proto_version=6.3 tf_provider_addr=registry.terraform.io/vercel/vercel tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c @module=sdk.proto diagnostic_detail="Could not create project, unexpected error: internal_server_error - An unexpected internal error occurred" tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_severity=ERROR tf_resource_type=vercel_project timestamp=2023-08-01T02:34:28.897Z
2023-08-01T02:34:28.898Z [TRACE] provider.terraform-provider-vercel_v0.15.0: Served request: @caller=github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:832 tf_proto_version=6.3 tf_req_id=51fd04f6-bbbf-f3d1-5c0d-6683e2e35e4c tf_resource_type=vercel_project @module=sdk.proto tf_provider_addr=registry.terraform.io/vercel/vercel tf_rpc=ApplyResourceChange timestamp=2023-08-01T02:34:28.897Z
2023-08-01T02:34:28.898Z [TRACE] maybeTainted: vercel_project.dev encountered an error during creation, so it is now marked as tainted
2023-08-01T02:34:28.898Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for vercel_project.dev
2023-08-01T02:34:28.898Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for vercel_project.dev
2023-08-01T02:34:28.898Z [TRACE] evalApplyProvisioners: vercel_project.dev is tainted, so skipping provisioning
2023-08-01T02:34:28.898Z [TRACE] maybeTainted: vercel_project.dev was already tainted, so nothing to do
2023-08-01T02:34:28.898Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for vercel_project.dev
2023-08-01T02:34:28.898Z [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for vercel_project.dev
2023-08-01T02:34:28.898Z [TRACE] statemgr.Filesystem: reading latest snapshot from terraform.tfstate
2023-08-01T02:34:28.898Z [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay
2023-08-01T02:34:28.898Z [TRACE] statemgr.Filesystem: read nil snapshot
2023-08-01T02:34:28.898Z [TRACE] statemgr.Filesystem: no original state snapshot to back up
2023-08-01T02:34:28.898Z [TRACE] statemgr.Filesystem: state has changed since last snapshot, so incrementing serial to 1
2023-08-01T02:34:28.898Z [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2023-08-01T02:34:28.900Z [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
Error: -01T02:34:28.900Z [ERROR] vertex "vercel_project.dev" error: Error creating project
2023-08-01T02:34:28.900Z [TRACE] vertex "vercel_project.dev": visit complete, with errors
2023-08-01T02:34:28.900Z [TRACE] dag/walk: upstream of "vercel_project_domain.dev" errored, so skipping
2023-08-01T02:34:28.900Z [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/vercel/vercel\"] (close)" errored, so skipping
2023-08-01T02:34:28.900Z [TRACE] dag/walk: upstream of "root" errored, so skipping
2023-08-01T02:34:28.900Z [TRACE] statemgr.Filesystem: reading latest snapshot from terraform.tfstate
2023-08-01T02:34:28.900Z [TRACE] statemgr.Filesystem: read snapshot with lineage "ea830b2e-2d7c-76cf-b1eb-28d14aaf171a" serial 1
2023-08-01T02:34:28.900Z [TRACE] statemgr.Filesystem: no original state snapshot to back up
2023-08-01T02:34:28.900Z [TRACE] statemgr.Filesystem: no state changes since last snapshot
2023-08-01T02:34:28.900Z [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate

│ Error: Error creating project

│   with vercel_project.dev,
│   on dev.tf line 2, in resource "vercel_project" "dev":
│    2: resource "vercel_project" "dev" {

│ Could not create project, unexpected error: internal_server_error - An
│ unexpected internal error occurred

2023-08-01T02:34:28.902Z [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2023-08-01T02:34:28.902Z [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2023-08-01T02:34:28.903Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-08-01T02:34:28.904Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/vercel/vercel/0.15.0/linux_amd64/terraform-provider-vercel_v0.15.0 pid=2046
2023-08-01T02:34:28.904Z [DEBUG] provider: plugin exited

Use `path_prefix` in determining whether files have changed

When using vercel_deployment with vercel_project_directory, the path_prefix isn't used in determining whether files have changed.

For example, our team uses a tool to scan through our dependencies and create a minimal version with only the files needed. This is then copied/linked to a temporary folder, when is then referenced by vercel_project_directory. While the hashes and files are the same, vercel_deployment triggers a redeployment everytime.

Terraform will perform the following actions:
# vercel_deployment.vercel-deployment_32649483 (vercel-deployment/deployment) must be replaced
-/+ resource "vercel_deployment" "vercel-deployment_32649483" {
              ...
              + "/var/folders/gy/8cy4sb_92y502v8wv5hsjtsm0000gn/T/OfodQm/yarn.lock"   = "1086964~d85fd5726542bfe41e9a838decc69de639cfe0d6"
              - "/var/folders/gy/8cy4sb_92y502v8wv5hsjtsm0000gn/T/d0rTTb/yarn.lock"   = "1086964~d85fd5726542bfe41e9a838decc69de639cfe0d6" -> null

vercel_dns_record is not a valid resource type

Based on the documentation, examples and code it looks like there should be support for the resource type vercel_dns_record yet using this resource type leads to this error:

The provider vercel/vercel does not support resource type "vercel_dns_record".

Is this a bug or will there soon be support for managing vercel DNS records?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.