-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpubsub.tf
41 lines (34 loc) · 1.01 KB
/
pubsub.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
resource "google_cloud_asset_folder_feed" "folder_feed" {
billing_project = var.project_id
folder = var.folder_id
feed_id = var.cloud_asset_folder_feed_id
content_type = "RESOURCE"
asset_types = [
"compute.googleapis.com/Instance"
]
feed_output_config {
pubsub_destination {
topic = google_pubsub_topic.feed_output.id
}
}
}
resource "google_pubsub_topic" "feed_output" {
name = var.topic_name
message_retention_duration = var.message_retention_duration
labels = var.labels
}
resource "google_pubsub_subscription" "sub" {
name = var.pubsub_subscription_name
topic = google_pubsub_topic.feed_output.id
push_config {
push_endpoint = "${google_cloud_run_v2_service.enrichment_service.uri}/event"
oidc_token {
service_account_email = google_service_account.service_account.email
}
attributes = {
x-goog-version = "v1"
}
}
labels = var.labels
depends_on = [google_cloud_run_v2_service.enrichment_service]
}