|
| 1 | +/** |
| 2 | + * Copyright 2018 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +module "pub" { |
| 18 | + source = "terraform-google-modules/pubsub/google//modules/pub" |
| 19 | + version = "~> 7.0" |
| 20 | + |
| 21 | + project_id = var.project_id |
| 22 | + topic = "cft-tf-pub-topic-cr-push" |
| 23 | + topic_labels = { |
| 24 | + foo_label = "foo_value" |
| 25 | + bar_label = "bar_value" |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +module "sub" { |
| 30 | + source = "terraform-google-modules/pubsub/google//modules/sub" |
| 31 | + version = "~> 7.0" |
| 32 | + |
| 33 | + project_id = var.project_id |
| 34 | + topic = module.pub.topic |
| 35 | + |
| 36 | + push_subscriptions = [ |
| 37 | + { |
| 38 | + name = module.cloud-run.service_name |
| 39 | + push_endpoint = module.cloud-run.service_uri |
| 40 | + oidc_service_account_email = module.cloud-run.service_account_id.email |
| 41 | + }, |
| 42 | + ] |
| 43 | +} |
| 44 | + |
| 45 | +module "cloud-run" { |
| 46 | + source = "GoogleCloudPlatform/cloud-run/google//modules/v2" |
| 47 | + version = "~> 0.17" |
| 48 | + project_id = var.project_id |
| 49 | + location = "us-central1" |
| 50 | + service_name = "cr-service" |
| 51 | + containers = [{ "container_name" = "", "container_image" = "gcr.io/design-center-container-repo/pubsub-cr-push:latest-1703" }] |
| 52 | + service_account_project_roles = ["roles/run.invoker"] |
| 53 | + members = ["allUsers"] |
| 54 | + cloud_run_deletion_protection = false |
| 55 | +} |
0 commit comments