{"id":18706972,"url":"https://github.com/terraform-google-modules/terraform-google-pubsub","last_synced_at":"2025-11-09T08:30:31.982Z","repository":{"id":37894783,"uuid":"153798747","full_name":"terraform-google-modules/terraform-google-pubsub","owner":"terraform-google-modules","description":"Creates Pub/Sub topic and subscriptions associated with the topic","archived":false,"fork":false,"pushed_at":"2025-02-07T18:02:14.000Z","size":532,"stargazers_count":94,"open_issues_count":8,"forks_count":129,"subscribers_count":40,"default_branch":"main","last_synced_at":"2025-02-07T18:19:24.563Z","etag":null,"topics":["cft-terraform","data-analytics"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/terraform-google-modules/pubsub/google","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terraform-google-modules.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-19T14:49:33.000Z","updated_at":"2025-02-07T17:01:05.000Z","dependencies_parsed_at":"2023-02-10T18:15:24.054Z","dependency_job_id":"39723ce7-ca55-480a-be9a-e664bcf87506","html_url":"https://github.com/terraform-google-modules/terraform-google-pubsub","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-pubsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-pubsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-pubsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraform-google-modules%2Fterraform-google-pubsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraform-google-modules","download_url":"https://codeload.github.com/terraform-google-modules/terraform-google-pubsub/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239571542,"owners_count":19661164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cft-terraform","data-analytics"],"created_at":"2024-11-07T12:16:04.358Z","updated_at":"2025-11-09T08:30:31.939Z","avatar_url":"https://github.com/terraform-google-modules.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-google-pubsub\n\nThis module makes it easy to create Google Cloud Pub/Sub topic and subscriptions associated with the topic.\n\n## Compatibility\nThis module is meant for use with Terraform 0.13+ and tested using Terraform 1.0+. If you find incompatibilities using Terraform \u003e=0.13, please open an issue.\n If you haven't\n[upgraded](https://www.terraform.io/upgrade-guides/0-13.html) and need a Terraform\n0.12.x-compatible version of this module, the last released version\nintended for Terraform 0.12.x is [v1.9.0](https://registry.terraform.io/modules/terraform-google-modules/-pubsub/google/v1.9.0).\n\n## Usage\n\nThis is a simple usage of the module. Please see also a simple setup provided in the example directory.\n\n```hcl\nmodule \"pubsub\" {\n  source  = \"terraform-google-modules/pubsub/google\"\n  version = \"~\u003e 7.0\"\n\n  topic      = \"tf-topic\"\n  project_id = \"my-pubsub-project\"\n  push_subscriptions = [\n    {\n      name                       = \"push\"                                               // required\n      ack_deadline_seconds       = 20                                                   // optional\n      push_endpoint              = \"https://example.com\"                                // required\n      x-goog-version             = \"v1beta1\"                                            // optional\n      oidc_service_account_email = \"sa@example.com\"                                     // optional\n      audience                   = \"example\"                                            // optional\n      expiration_policy          = \"1209600s\"                                           // optional\n      dead_letter_topic          = \"projects/my-pubsub-project/topics/example-dl-topic\" // optional\n      max_delivery_attempts      = 5                                                    // optional\n      maximum_backoff            = \"600s\"                                               // optional\n      minimum_backoff            = \"300s\"                                               // optional\n      filter                     = \"attributes.domain = \\\"com\\\"\"                        // optional\n      enable_message_ordering    = true                                                 // optional\n    }\n  ]\n  pull_subscriptions = [\n    {\n      name                         = \"pull\"                                               // required\n      ack_deadline_seconds         = 20                                                   // optional\n      dead_letter_topic            = \"projects/my-pubsub-project/topics/example-dl-topic\" // optional\n      max_delivery_attempts        = 5                                                    // optional\n      maximum_backoff              = \"600s\"                                               // optional\n      minimum_backoff              = \"300s\"                                               // optional\n      filter                       = \"attributes.domain = \\\"com\\\"\"                        // optional\n      enable_message_ordering      = true                                                 // optional\n      service_account              = \"service2@project2.iam.gserviceaccount.com\"          // optional\n      enable_exactly_once_delivery = true                                                 // optional\n    }\n  ]\n  bigquery_subscriptions = [\n    {\n      name                = \"bigquery\"              // required\n      table               = \"project.dataset.table\" // required\n      use_topic_schema    = true                    // optional\n      use_table_schema    = false                   // optional\n      write_metadata      = false                   // optional\n      drop_unknown_fields = false                   // optional\n    }\n  ]\n  cloud_storage_subscriptions = [\n    {\n      name                     = \"cloud-storage\"        // required\n      bucket                   = \"example-bucket\"       // required\n      filename_prefix          = \"log_events_\"          // optional\n      filename_suffix          = \".avro\"                // optional\n      filename_datetime_format = \"YYYY-MM-DD/hh_mm_ssZ\" // optional\n      max_duration             = \"60s\"                  // optional\n      max_bytes                = \"10000000\"             // optional\n      max_messages             = \"10000\"                // optional\n      output_format            = \"avro\"                 // optional\n      write_metadata           = false                  // optional\n      use_topic_schema         = false                  // optional\n    }\n  ]\n}\n```\n\n\u003c!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| bigquery\\_subscriptions | The list of the Bigquery push subscriptions. | \u003cpre\u003elist(object({\u003cbr\u003e    name                       = string,\u003cbr\u003e    table                      = string,\u003cbr\u003e    use_topic_schema           = optional(bool, true),\u003cbr\u003e    use_table_schema           = optional(bool, false),\u003cbr\u003e    write_metadata             = optional(bool, false),\u003cbr\u003e    drop_unknown_fields        = optional(bool, false),\u003cbr\u003e    ack_deadline_seconds       = optional(number),\u003cbr\u003e    retain_acked_messages      = optional(bool, false),\u003cbr\u003e    message_retention_duration = optional(string),\u003cbr\u003e    enable_message_ordering    = optional(bool, false),\u003cbr\u003e    expiration_policy          = optional(string),\u003cbr\u003e    filter                     = optional(string),\u003cbr\u003e    dead_letter_topic          = optional(string),\u003cbr\u003e    maximum_backoff            = optional(string),\u003cbr\u003e    minimum_backoff            = optional(string)\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| cloud\\_storage\\_subscriptions | The list of the Cloud Storage push subscriptions. | \u003cpre\u003elist(object({\u003cbr\u003e    name                       = string,\u003cbr\u003e    bucket                     = string,\u003cbr\u003e    filename_prefix            = optional(string),\u003cbr\u003e    filename_suffix            = optional(string),\u003cbr\u003e    filename_datetime_format   = optional(string),\u003cbr\u003e    max_duration               = optional(string),\u003cbr\u003e    max_bytes                  = optional(string),\u003cbr\u003e    max_messages               = optional(string),\u003cbr\u003e    output_format              = optional(string),\u003cbr\u003e    write_metadata             = optional(bool, false),\u003cbr\u003e    use_topic_schema           = optional(bool, false),\u003cbr\u003e    ack_deadline_seconds       = optional(number),\u003cbr\u003e    retain_acked_messages      = optional(bool, false),\u003cbr\u003e    message_retention_duration = optional(string),\u003cbr\u003e    enable_message_ordering    = optional(bool, false),\u003cbr\u003e    expiration_policy          = optional(string),\u003cbr\u003e    filter                     = optional(string),\u003cbr\u003e    dead_letter_topic          = optional(string),\u003cbr\u003e    maximum_backoff            = optional(string),\u003cbr\u003e    minimum_backoff            = optional(string)\u003cbr\u003e  }))\u003c/pre\u003e | `[]` | no |\n| create\\_subscriptions | Specify true if you want to create subscriptions. | `bool` | `true` | no |\n| create\\_topic | Specify true if you want to create a topic. | `bool` | `true` | no |\n| grant\\_bigquery\\_project\\_roles | Specify true if you want to add bigquery.metadataViewer and bigquery.dataEditor roles to the default Pub/Sub SA. | `bool` | `true` | no |\n| grant\\_token\\_creator | Specify true if you want to add token creator role to the default Pub/Sub SA. | `bool` | `true` | no |\n| message\\_storage\\_policy | A map of storage policies. Default - inherit from organization's Resource Location Restriction policy. | `map(any)` | `{}` | no |\n| project\\_id | The project ID to manage the Pub/Sub resources. | `string` | n/a | yes |\n| pull\\_subscriptions | The list of the pull subscriptions. | `list(map(string))` | `[]` | no |\n| push\\_subscriptions | The list of the push subscriptions. | `list(map(string))` | `[]` | no |\n| schema | Schema for the topic. | \u003cpre\u003eobject({\u003cbr\u003e    name       = string\u003cbr\u003e    type       = string\u003cbr\u003e    definition = string\u003cbr\u003e    encoding   = string\u003cbr\u003e  })\u003c/pre\u003e | `null` | no |\n| subscription\\_labels | A map of labels to assign to every Pub/Sub subscription. | `map(string)` | `{}` | no |\n| topic | The Pub/Sub topic name. | `string` | n/a | yes |\n| topic\\_kms\\_key\\_name | The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. | `string` | `null` | no |\n| topic\\_labels | A map of labels to assign to the Pub/Sub topic. | `map(string)` | `{}` | no |\n| topic\\_message\\_retention\\_duration | The minimum duration in seconds to retain a message after it is published to the topic. | `string` | `null` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| id | The ID of the Pub/Sub topic |\n| subscription\\_names | The name list of Pub/Sub subscriptions |\n| subscription\\_paths | The path list of Pub/Sub subscriptions |\n| topic | The name of the Pub/Sub topic |\n| topic\\_labels | Labels assigned to the Pub/Sub topic |\n| uri | The URI of the Pub/Sub topic |\n\n\u003c!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --\u003e\n\n## Requirements\n\n### Installation Dependencies\n\n- [Terraform](https://www.terraform.io/downloads.html) \u003e= 0.13.0\n- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) plugin \u003e= v2.13\n\n### Configure a Service Account\n\nIn order to execute this module you must have a Service Account with the following:\n\n#### Roles\n\n- `roles/pubsub.admin`\n\n### Enable APIs\n\nIn order to operate with the Service Account you must activate the following APIs on the project where the Service Account was created:\n\n- Cloud Pub/Sub API\n\n#### Service Account Credentials\n\nYou can pass the service account credentials into this module by setting the following environment variables:\n\n* `GOOGLE_CREDENTIALS`\n* `GOOGLE_CLOUD_KEYFILE_JSON`\n* `GCLOUD_KEYFILE_JSON`\n\nSee more [details](https://www.terraform.io/docs/providers/google/provider_reference.html#configuration-reference).\n\n[v0.2.0]: https://registry.terraform.io/modules/terraform-google-modules/pubsub/google/0.2.0\n[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-google-modules%2Fterraform-google-pubsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraform-google-modules%2Fterraform-google-pubsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraform-google-modules%2Fterraform-google-pubsub/lists"}