This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
tlogistry.tf
78 lines (67 loc) · 1.54 KB
/
tlogistry.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
terraform {
required_providers {
ko = {
source = "imjasonh/ko"
version = "0.0.1"
}
google = {
source = "hashicorp/google"
version = "4.26.0"
}
}
}
provider "ko" {
docker_repo = "gcr.io/${var.project}"
}
variable "project" {
type = string
default = "kontaindotme"
}
variable "region" {
type = string
default = "us-east4"
}
provider "google" {
project = var.project
}
resource "ko_image" "tlogistry" {
importpath = "github.com/chainguard-dev/tlogistry"
}
resource "google_cloud_run_service" "svc" {
name = "tlogistry"
location = var.region
template {
spec {
containers {
image = ko_image.tlogistry.image_ref
}
service_account_name = google_service_account.sa.email
}
}
traffic {
percent = 100
latest_revision = true
}
}
output "url" {
value = google_cloud_run_service.svc.status[0].url
}
// Anybody can access the service.
data "google_iam_policy" "noauth" {
binding {
role = "roles/run.invoker"
members = ["allUsers"]
}
}
resource "google_cloud_run_service_iam_policy" "noauth" {
location = google_cloud_run_service.svc.location
project = google_cloud_run_service.svc.project
service = google_cloud_run_service.svc.name
policy_data = data.google_iam_policy.noauth.policy_data
}
// The service runs as a minimal service account with no permissions in the project.
resource "google_service_account" "sa" {
account_id = "tlogistry"
display_name = "Minimal Service Account"
}
// TODO: domain mapping