This file contains hidden or 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
| output "service_account_email" { | |
| value = google_service_account.service_account.email | |
| description = "The service-account that the function runs under." | |
| } | |
| output "source_bucket" { | |
| value = google_storage_bucket.function.name | |
| description = "The bucket created to hold the function source code" | |
| } |
This file contains hidden or 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
| variable "project_id" { | |
| type = string | |
| description = "The project where the function should be deployed" | |
| } | |
| variable "function_name" { | |
| type = string | |
| description = "The name of this function" | |
| } |
This file contains hidden or 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
| resource "google_project_service" "cloud-functions" { | |
| project = var.project_id | |
| service = "cloudfunctions.googleapis.com" | |
| disable_on_destroy = false | |
| } | |
| resource "google_project_service" "cloudbuild" { | |
| project = var.project_id | |
| service = "cloudbuild.googleapis.com" |
This file contains hidden or 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
| resource "google_cloudfunctions_function" "function" { | |
| name = var.function_name | |
| project = var.project_id | |
| available_memory_mb = var.available_memory_mb | |
| timeout = var.timeout | |
| region = var.region | |
| service_account_email = google_service_account.service_account.email | |
| runtime = var.runtime | |
| entry_point = var.entry_point |
This file contains hidden or 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
| resource "random_id" "service-account" { | |
| byte_length = 4 | |
| } | |
| resource "google_service_account" "service_account" { | |
| account_id = "function-${random_id.service-account.hex}" | |
| display_name = "Service account for the ${var.function_name} cloud-function" | |
| project = var.project_id | |
| } |
This file contains hidden or 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
| data "google_client_openid_userinfo" "terraform" {} | |
| data "archive_file" "function" { | |
| type = "zip" | |
| output_path = "${path.module}/function.zip" | |
| dynamic "source" { | |
| for_each = toset(var.source_files) | |
| content { |
This file contains hidden or 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
| resource "random_id" "bucket" { | |
| byte_length = 6 | |
| } | |
| resource "google_storage_bucket" "function" { | |
| project = var.project_id | |
| name = "${var.project_id}_${random_id.bucket.hex}" | |
| location = "EU" | |
| storage_class = "MULTI_REGIONAL" |
This file contains hidden or 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
| <form> | |
| <label>Admin Dashboard</label> | |
| <fieldset submitButton="false"></fieldset> | |
| <row> | |
| <panel> | |
| <title>Number of Active Users</title> | |
| <single> | |
| <search> | |
| <query>| dbxquery query="SELECT count(*) FROM user" connection="Local"</query> | |
| <earliest>-24h@h</earliest> |
This file contains hidden or 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
| <input type="dropdown" token="site_month"> | |
| <label>Site</label> | |
| <fieldForLabel>name</fieldForLabel> | |
| <fieldForValue>id</fieldForValue> | |
| <choice value="`site_id`">All</choice> | |
| <search> | |
| <query>| dbxquery query="SELECT name, CONCAT('\'',id,'\'') AS id FROM site" connection="Local"</query> | |
| <earliest>-24h@h</earliest> | |
| <latest>now</latest> | |
| </search> |
This file contains hidden or 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
| | dbxquery query="SELECT modality, SUM(amount) as amount, MONTH(created_on) AS month FROM TRANSACTION WHERE STATUS='success' AND site_id=$site_month$ AND site_id IN (SELECT id FROM site WHERE organization_id=$org_month$) AND YEAR(created_on) = YEAR(CURRENT_DATE()) GROUP BY modality, MONTH(created_on)" connection="Local"| chart first(amount) over month by modality |
NewerOlder