Skip to content

Commit

Permalink
feat: adding labels to pubsub_push_subscription resource (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgEsteves committed Jun 14, 2023
1 parent 293633d commit 917f371
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ steps:

- id: init-all
waitFor:
- prepare
- destroy
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run all --stage init --verbose']
- id: go-apply-logbucket-folder
Expand Down
2 changes: 1 addition & 1 deletion modules/pubsub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ so that all dependencies are met.
| project\_id | The ID of the project in which the pubsub topic will be created. | `string` | n/a | yes |
| push\_endpoint | The URL locating the endpoint to which messages should be pushed. | `string` | `""` | no |
| subscriber\_id | The ID to give the pubsub pull subscriber service account (optional). | `string` | `""` | no |
| subscription\_labels | A set of key/value label pairs to assign to the pubsub subscription. | `map(string)` | `{}` | no |
| subscription\_labels | A set of key/value label pairs to assign to the pubsub subscription or pubsub push subscription. | `map(string)` | `{}` | no |
| topic\_labels | A set of key/value label pairs to assign to the pubsub topic. | `map(string)` | `{}` | no |
| topic\_name | The name of the pubsub topic to be created and used for log entries matching the filter. | `string` | n/a | yes |

Expand Down
1 change: 1 addition & 0 deletions modules/pubsub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ resource "google_pubsub_subscription" "pubsub_push_subscription" {
name = "${local.topic_name}-push-subscription"
project = var.project_id
topic = local.topic_name
labels = var.subscription_labels

push_config {
push_endpoint = var.push_endpoint
Expand Down
2 changes: 1 addition & 1 deletion modules/pubsub/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ variable "subscriber_id" {
variable "subscription_labels" {
type = map(string)
default = {}
description = "A set of key/value label pairs to assign to the pubsub subscription."
description = "A set of key/value label pairs to assign to the pubsub subscription or pubsub push subscription."
}

variable "create_push_subscriber" {
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/computed_values/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ resource "google_project" "computed" {
billing_account = var.parent_resource_billing_account
}

resource "google_project_service" "project" {
project = google_project.computed.id
service = "logging.googleapis.com"

disable_dependent_services = false
disable_on_destroy = false
}

module "log_export" {
source = "../../../examples/storage/project"
parent_resource_id = google_project.computed.project_id
Expand Down
6 changes: 4 additions & 2 deletions test/setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ module "project" {
"storage-component.googleapis.com",
"storage-api.googleapis.com",
"iam.googleapis.com",
"cloudbilling.googleapis.com"
"cloudbilling.googleapis.com",
"logging.googleapis.com",
]
}

Expand All @@ -64,7 +65,8 @@ module "project_destination_logbkt" {
"storage-component.googleapis.com",
"storage-api.googleapis.com",
"iam.googleapis.com",
"cloudbilling.googleapis.com"
"cloudbilling.googleapis.com",
"logging.googleapis.com",
]
}

Expand Down

0 comments on commit 917f371

Please sign in to comment.