-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add: sample terraform template to deploy cru as a service
- Loading branch information
1 parent
7c01aeb
commit d3c71f3
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.iml | ||
.terraform/ | ||
.idea/ | ||
cru | ||
x/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
terraform.tfstate* | ||
.terraform.lock.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
resource "google_cloud_run_service" "container_reference_updater" { | ||
name = "container-reference-updater" | ||
location = "us-central1" | ||
project = data.google_client_config.current.project | ||
|
||
template { | ||
spec { | ||
container_concurrency = 1 | ||
service_account_name = google_service_account.container_reference_updater.email | ||
containers { | ||
image = "gcr.io/binx-io-public/cru:0.9.0" | ||
args = [ | ||
"serve", | ||
"--repository", | ||
"https://source.developers.google.com/p/speeltuin-mvanholsteijn/r/scratch", | ||
"--branch", | ||
"main", | ||
] | ||
} | ||
} | ||
} | ||
timeouts { | ||
create = "10m" | ||
} | ||
} | ||
|
||
resource "google_cloud_run_service_iam_binding" "container_reference_updater_invokers" { | ||
service = google_cloud_run_service.container_reference_updater.name | ||
location = google_cloud_run_service.container_reference_updater.location | ||
project = google_cloud_run_service.container_reference_updater.project | ||
role = "roles/run.invoker" | ||
members = [ | ||
"allUsers" | ||
] | ||
} | ||
|
||
resource "google_service_account" "container_reference_updater" { | ||
display_name = "Container image reference updater" | ||
account_id = "container-reference-updater" | ||
} | ||
|
||
resource "google_project_iam_member" "cru_source_code_repository_writer" { | ||
member = format("serviceAccount:%s", google_service_account.container_reference_updater.email) | ||
role = "roles/source.writer" | ||
project = data.google_client_config.current.project | ||
} | ||
|
||
data google_client_config current {} |