ops: domain, .env generator
This commit is contained in:
parent
5cf183ec6f
commit
5f19ff1c98
1
tf/.gitignore
vendored
1
tf/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/*.tfstate*
|
/*.tfstate*
|
||||||
/.terraform*
|
/.terraform*
|
||||||
|
/prod.tfvars
|
||||||
|
|
33
tf/main.tf
33
tf/main.tf
|
@ -4,30 +4,45 @@ terraform {
|
||||||
source = "vercel/vercel"
|
source = "vercel/vercel"
|
||||||
version = "~> 0.1"
|
version = "~> 0.1"
|
||||||
}
|
}
|
||||||
|
local = {
|
||||||
|
source = "hashicorp/local"
|
||||||
|
version = "~> 2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "vercel" {
|
provider "vercel" {
|
||||||
# Or omit this for the api_token to be read
|
api_token = var.vercel_api_token
|
||||||
# from the VERCEL_API_TOKEN environment variable
|
|
||||||
# api_token = var.vercel_api_token
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "vercel_project" "with_git" {
|
resource "vercel_project" "metaforecast" {
|
||||||
name = "metaforecast-test"
|
name = "metaforecast"
|
||||||
team_id = "quantified-uncertainty"
|
team_id = "quantified-uncertainty"
|
||||||
framework = "nextjs"
|
framework = "nextjs"
|
||||||
|
|
||||||
environment = [
|
environment = [
|
||||||
{
|
for k, v in var.metaforecast_env : {
|
||||||
key = "NEXT_PUBLIC_ALGOLIA_APP_ID"
|
key = k
|
||||||
value = "96UD3NTQ7L"
|
value = v
|
||||||
target = ["production"]
|
target = ["production"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
git_repository = {
|
git_repository = {
|
||||||
type = "github"
|
type = "github"
|
||||||
repo = "berekuk/metaforecast"
|
repo = "QURIresearch/metaforecast"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
7
tf/variables.tf
Normal file
7
tf/variables.tf
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
variable "metaforecast_env" {
|
||||||
|
type = map(string)
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "vercel_api_token" {
|
||||||
|
type = string
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user