Skip to content

Commit

Permalink
Merge pull request #48 from NandosUK/NAP-314/cloudbuild-webhook-notif…
Browse files Browse the repository at this point in the history
…ication

Switch subscription type for cloud-builds notifications
  • Loading branch information
matthew-green-nandos authored Aug 24, 2021
2 parents 49a958c + 8acc69f commit b715557
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ resource "google_cloud_run_service" "http_notification" {
google_storage_bucket_object.http_notification,
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "name" {
value = google_cloud_run_service.http_notification.name
}

output "url" {
value = google_cloud_run_service.http_notification.status[0]["url"]
}
10 changes: 9 additions & 1 deletion experimental/terraform/data_parser/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
output "cloud_run_endpoint" {
value = google_cloud_run_service.parser.status[0]["url"]
}
}

output "trigger_name" {
value = module.cloudbuild_for_parser.name
}

output "notification_url" {
value = module.cloudbuild_notification.url
}
2 changes: 1 addition & 1 deletion experimental/terraform/resource_event_handler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ module "event_handler_cloudbuild_notification" {
trigger_id = module.event_handler_cloudbuild_trigger.id
trigger_name = module.event_handler_cloudbuild_trigger.name
url = length(var.mapped_domain) > 0 ? try("https://${var.subdomain}.${var.mapped_domain}", null) : google_cloud_run_service.event_handler.status[0]["url"]
}
}
14 changes: 9 additions & 5 deletions experimental/terraform/resource_pubsub.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ module "pubsub" {

topic = "cloud-builds" # see https://cloud.google.com/build/docs/configuring-notifications/configure-https for set up and consumption
project_id = var.google_project_id
pull_subscriptions = [
{
name = "pull"

push_subscriptions = concat([for item in var.parsers : {
name = module.data_parser_service[item].trigger_name
push_endpoint = module.data_parser_service[item].notification_url
service_account = module.service_account_for_cloudrun.email
}
]
}],[{
name = module.event_handler_cloudbuild_trigger.name
push_endpoint = module.event_handler_cloudbuild_notification.url
service_account = module.service_account_for_cloudrun.email
}])
}

0 comments on commit b715557

Please sign in to comment.