metaforecast/tf/main.tf

49 lines
1.0 KiB
Terraform
Raw Normal View History

2022-04-11 18:03:47 +00:00
terraform {
required_providers {
vercel = {
source = "vercel/vercel"
version = "~> 0.1"
}
2022-04-11 19:38:00 +00:00
local = {
source = "hashicorp/local"
version = "~> 2"
}
2022-04-11 18:03:47 +00:00
}
}
provider "vercel" {
2022-04-11 19:38:00 +00:00
api_token = var.vercel_api_token
2022-04-11 18:03:47 +00:00
}
2022-04-11 19:38:00 +00:00
resource "vercel_project" "metaforecast" {
name = "metaforecast"
2022-04-11 18:03:47 +00:00
team_id = "quantified-uncertainty"
framework = "nextjs"
environment = [
2022-04-11 19:38:00 +00:00
for k, v in var.metaforecast_env : {
key = k
value = v
2022-04-11 18:03:47 +00:00
target = ["production"]
}
]
git_repository = {
type = "github"
2022-04-11 19:38:00 +00:00
repo = "QURIresearch/metaforecast"
2022-04-11 18:03:47 +00:00
}
}
2022-04-11 19:38:00 +00:00
resource "vercel_project_domain" "metaforecast" {
project_id = vercel_project.metaforecast.id
domain = "metaforecast.org"
team_id = "quantified-uncertainty"
}
// should probably be replaced with local bash script
resource "local_file" "foo" {
content = join("", concat(["# generated by terraform\n"], [for k, v in var.metaforecast_env : "${k} = \"${v}\"\n"]))
filename = "${path.module}/../.env.prod"
file_permission = "0644"
}