chronark / terraform-provider-vercel Goto Github PK
View Code? Open in Web Editor NEWA terraform provider for vercel's hosting platform
Home Page: ff789693-5a72-142e-e45d-326ead4ae7a4.vercel.app
License: Mozilla Public License 2.0
A terraform provider for vercel's hosting platform
Home Page: ff789693-5a72-142e-e45d-326ead4ae7a4.vercel.app
License: Mozilla Public License 2.0
Hi, I'm trying to use this on my M1 MacBook Pro and I get this error
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/chronark/vercel v0.14.0 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms
│ supported.
I looked at the .goreleaser.yaml
file but I can't seem to find anything wrong with it that'd be ignoring darwin_arm64
. Could you take a look too?
v10.0.0
Please list the resources as a list, for example:
resource "vercel_project" "foodbudget" {
name = "foodbudget"
framework = "nextjs"
root_directory = "packages/@foodbudget/frontend"
git_repository {
type = "github"
repo = "jacktan165/foodbudget"
}
}
resource "vercel_env" "env" {
project_id = vercel_project.foodbudget.id
type = "plain"
key = "NEXT_PUBLIC_API_URL"
value = "https://api.foodbudget.tk"
target = ["production", "preview", "development"]
}
resource "vercel_domain" "prod" {
name = "foodbudget.tk"
}
resource "vercel_alias" "prod" {
project_id = vercel_project.foodbudget.id
domain = vercel_domain.prod.name
}
resource "vercel_alias" "prod_www" {
project_id = vercel_project.foodbudget.id
domain = "www.foodbudget.tk"
redirect = vercel_alias.prod.domain
}
resource "vercel_dns" "prod_a_record" {
domain = vercel_domain.prod.name
type = "A"
name = "www"
value = "76.76.21.21"
}
resource "vercel_dns" "api" {
domain = vercel_domain.prod.name
type = "CNAME"
name = "api"
value = module.foodbudget_lb.lb.dns_name
depends_on = [
module.foodbudget_lb.lb
]
}
resource "vercel_dns" "prod_caa_record" {
domain = vercel_domain.prod.name
type = "CAA"
name = ""
value = "0 issue \"amazon.com\""
depends_on = [
module.foodbudget_lb.lb
]
}
resource "vercel_dns" "cert" {
domain = vercel_domain.prod.name
type = tolist(aws_acm_certificate.foodbudget.domain_validation_options)[0].resource_record_type
name = tolist(aws_acm_certificate.foodbudget.domain_validation_options)[0].resource_record_name
value = tolist(aws_acm_certificate.foodbudget.domain_validation_options)[0].resource_record_value
}
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of Terraform since the last "terraform apply":
# vercel_project.foodbudget has been changed
~ resource "vercel_project" "foodbudget" {
~ alias = [
"foodbudget.vercel.app",
+ "foodbudget.tk",
+ "www.foodbudget.tk",
]
id = "prj_R7sZ79xRAmnOiRr8hGMwKExq7CjT"
name = "foodbudget"
# (8 unchanged attributes hidden)
# (1 unchanged block hidden)
}
# vercel_domain.prod has been changed
~ resource "vercel_domain" "prod" {
id = "QmetFZiVBcpxQG2a9kpGDmP3zMQ8JGLQXfjeyhzu7heTG6"
name = "foodbudget.tk"
~ ns_verified_at = 1623930884154 -> 1623946518086
# (12 unchanged attributes hidden)
}
# vercel_dns.api has been changed
~ resource "vercel_dns" "api" {
id = "rec_1454cfc4ad85258c41759531"
name = "api"
~ updated = 1623946519861 -> 1623946529703
~ updated_at = 1623946519861 -> 1623946529703
# (7 unchanged attributes hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# vercel_dns.api must be replaced
-/+ resource "vercel_dns" "api" {
~ created = 1623946519861 -> (known after apply)
~ created_at = 1623946519861 -> (known after apply)
~ creator = "nqUzOXR9ZLbkknmWT1vSwt8Z" -> (known after apply)
~ id = "rec_1454cfc4ad85258c41759531" -> (known after apply)
name = "api"
~ updated = 1623946529703 -> (known after apply)
~ updated_at = 1623946529703 -> (known after apply)
~ value = "foodbudget-prod-lb-652827199.ap-southeast-2.elb.amazonaws.com." -> "foodbudget-prod-lb-652827199.ap-southeast-2.elb.amazonaws.com" # forces replacement
# (3 unchanged attributes hidden)
}
# vercel_dns.cert must be replaced
-/+ resource "vercel_dns" "cert" {
~ created = 1623946519795 -> (known after apply)
~ created_at = 1623946519795 -> (known after apply)
~ creator = "nqUzOXR9ZLbkknmWT1vSwt8Z" -> (known after apply)
~ id = "rec_d6526060a2f0a33d355ffa51" -> (known after apply)
~ name = "_5c4a3f13d9996761f16a2d0fba623bca" -> "_5c4a3f13d9996761f16a2d0fba623bca.foodbudget.tk." # forces replacement
~ updated = 1623946519795 -> (known after apply)
~ updated_at = 1623946519795 -> (known after apply)
# (4 unchanged attributes hidden)
}
When I run terraform apply
after running it initially, it should not do anything.
It constantly says those resources must be replaced.
Please list the steps required to reproduce the issue, for example:
terraform apply
See: https://github.com/chronark/terraform-provider-vercel/blob/main/internal/provider/provider.go#L34
(Sorry I don't really know go well enough to provide a PR! Maybe I'll get an excuse one day...)
We're using your provider and extremely happy with it so far. The Provider type requires a token, but because it's loaded from an environment variable by default, it should be optional.
0.14
I used vercel_alias to redirect www.website.com to website.com, after v10.0.1 that resource was removed. Is there an alternative to this?
While not documented by this repo, you can successfully create a vercel_env
with type encrypted
.
However, these resources will always have changes applied to them. It would be great if support for type = "encrypted"
was improved, as Vercel is planning to deprecate secrets https://vercel.com/docs/rest-api#endpoints/secrets
Terraform v1.0.11
on linux_amd64
resource "vercel_project" "test" {
name = "test"
git_repository {
type = "github"
repo = "marklawlor/test"
}
framework = "nextjs"
}
resource "vercel_env" "test" {
project_id = vercel_project.test.id
type = "encrypted"
key = "test"
value = random_password.test.result
target = ["production"]
}
resource "random_password" "test" {
length = 16
special = true
}
Should detect no changes when running terraform apply
multiple times
~ resource "vercel_env" "test" {
id = "RiZ1UbFy3BbC6x3m"
~ key = "" -> "test"
~ target = [
+ "production",
]
~ type = "" -> "encrypted"
# Warning: this attribute value will no longer be marked as sensitive
# after applying this change.
~ value = (sensitive) -> (known after apply)
# (3 unchanged attributes hidden)
}
It seems like MX
-records are not supported in the vercel_dns
-resource. I'm open to doing a PR for this. 🤠
Terraform v1.1.7
on darwin_amd64
+ provider registry.terraform.io/chronark/vercel v0.14.4
resource "vercel_dns" "mail_mx01" {
name = ""
type = "MX"
domain = "mydomain.example"
value = "10 mx01.mail.icloud.com." # initially expected this to work
}
No panic.
The record being created as specified.
The record was not created.
╷
│ Error: Unable to request resource: [POST] /v2/domains/mydomain.example/records with payload {}: Error during http request: map[error:map[code:bad_request message:Invalid request: missing required property `mxPriority`.]]
│
│ with vercel_dns.mail_mx01,
│ on dns.tf line 33, in resource "vercel_dns" "mail_mx01":
│ 33: resource "vercel_dns" "mail_mx01" {
│
terraform apply
Nope.
Nope.
1.0.11
I will need to sanitize the relevant configuration files, will attach shortly.
Same as configuration files.
I used terraform import
to import a vercel resource into my state, but the multiple domain
blocks configured in that resource were not imported, so terraform wants to change the resource unnecessarily.
Terraform wants to change project domains to match
Please list the steps required to reproduce the issue, for example:
terraform import vercel_project.foo myorg/foo
terraform plan
# vercel_project.foo will be updated in-place
~ resource "vercel_project" "foo" {
id = "[REDACTED]"
name = "foo"
# (9 unchanged attributes hidden)
+ domain {
+ git_branch = "main"
+ name = "foo.bar"
}
+ domain {
+ git_branch = "main"
+ name = "www.foo.bar"
}
# (1 unchanged block hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Hi!
I'm trying to configure Google Suite emails and was looking for the email preset option:
but from what I can see, it's not implemented yet (not sure if it's even possible to implement it)
Instead I'm now trying to manually add all of the DNS records but I ran into an issue - I can't set the priority field as it's missing -
Do you have any plans on adding support for either?
Hi there again! 😇
For given example
resource "vercel_project" "web" {
name = "web"
git_repository {
type = "gitlab"
repo = "foo/bar"
}
domain {
name = foo.example.com
git_branch = "stage"
}
}
project domain's git branch is not set.
In resource_project.go
in lines 234-238 the code is not passing git_branch
value and also not sending gitBranch
as part of the request to create a project domain.
Terraform version: 1.0.2
vercel provider version: 0.11.0
And once again, thank you for working on this handy project 😉
Hi there!
Thank you for creating this, it's really a great terraform provider for a great platform!
Currently I'm able to set a single domain with a single git branch per project, but often in reality we need multiple domains.
resource "vercel_project" "web" {
name = "web"
git_repository {
type = "gitlab"
repo = "foo/bar"
}
domain {
name = "foo-dev.example.com"
git_branch = "master"
}
}
Vercel UI and API allow for multiple domains in a single project. Using the API we could set up one domain for development, one for staging etc. Something like this:
resource "vercel_project" "web" {
name = "web"
git_repository {
type = "gitlab"
repo = "foo/bar"
}
domain {
name = "foo-dev.example.com"
git_branch = "master"
}
domain {
name = "foo-stage.example.com"
git_branch = "stage"
}
}
Currently, I see that you are limiting the number of domain
blocks to 1 which is why the example above is (expectedly) failing.
Temp workaround could be to create N number of projects where N is the number of domains and their appropriate deploy environments.
Hi there, i'm having troubles when try to add domain block in project resource.
Run terraform -v
to show the version. We support terraform v0.13+
terraform -v
Terraform v1.0.4
on darwin_amd64
+ provider registry.terraform.io/chronark/vercel v0.10.4
+ provider registry.terraform.io/hashicorp/google-beta v4.1.0
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
provider "vercel" {
# Configuration options
token = var.vercel_token
}
resource "vercel_domain" "main" {
for_each = var.states
name = each.value.domain
}
resource "vercel_project" "projects" {
for_each = var.states
name = "${each.value.state}-${var.project_name}"
team_id = var.team_id
framework = "nextjs"
build_command = "yarn build"
git_repository {
type = "github"
repo = var.github_repo
}
domain {
name = vercel_domain.main.name
}
// domain {
// name = "www.${vercel_domain.main.name}"
// redirect = vercel_domain.main.name
// redirect_status_code = 308
// }
}
No panic
Should create project in Vercel, without this domain block in project resource everything works fine.
Unsupported block
Please list the steps required to reproduce the issue, for example:
terraform apply
or terraform plan
Hi, first of all, I'm really grateful for this package, awesome work!
I want to specify a cname on cloudflare for the deployed IP address and wondering if there is a possibility to retrieve that?
Hi there,
Thank you so much for making this module! I'll probably be making heavy use of it over the next couple months, and I really appreciate the work you put in. Unfortunately I couldn't get the new vercel domain stuff you just added to work quick right for me. Maybe I misconfigured something? Any help would be greatly appreciated.
Terraform v0.15.3
on darwin_amd64
+ provider registry.terraform.io/chronark/vercel v0.10.0
+ provider registry.terraform.io/hashicorp/github v4.9.4
+ provider registry.terraform.io/integrations/github v4.9.4
Please list the resources as a list, for example:
resource "vercel_domain" "antarahaldar_com" {
team_id = var.vercel_team_id
name = "antarahaldar.com"
}
│ Error: Unable to fetch domain from vercel: Unable to request resource: [GET] /v4/domains/antarahaldar.com/?teamId=team_Mb1ivhnQAH2uo2nNrPBbDwk4 with payload {<nil>}: Error during http request: map[error:map[code:not_found message:The requested API endpoint was not found.]]
│
│ with vercel_domain.antarahaldar_com,
│ on antara.tf line 22, in resource "vercel_domain" "antarahaldar_com":
│ 22: resource "vercel_domain" "antarahaldar_com" {
It should create the domain and not error
The domain is created as expected in vercel, but terraform thinks it failed and exists with this error.
Terraform v1.1.3
resource "vercel_project" "all_trace" {
...
domain {
name = <HIDDEN>
git_branch = "example-branch"
}
}
Update the domain's git-branch setting.
Not updated!
It appears the git_branch has no effect on the domain, every other field works expected except this.
Happy to help out! First git issue I have logged, apologies if I did something incorrectly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.