Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 3.3 KB

README.md

File metadata and controls

96 lines (69 loc) · 3.3 KB

terraform-google-pubsub

This module makes it easy to create Google Cloud Pub/Sub topic and subscriptions associated with the topic.

Compatibility

This module is meant for use with Terraform 0.12. If you haven't upgraded and need a Terraform 0.11.x-compatible version of this module, the last released version intended for Terraform 0.11.x is 0.2.0.

Usage

This is a simple usage of the module. Please see also a simple setup provided in the example directory.

module "pubsub" {
  source  = "terraform-google-modules/pubsub/google"
  version = "~> 1.0"

  topic              = "tf-topic"
  project_id         = "my-pubsub-project"
  push_subscriptions = [
    {
      name                 = "push"   // required
      ack_deadline_seconds = 20 // optional
      push_endpoint        = "https://example.com" // required
      x-goog-version       = "v1beta1" // optional
    }
  ]
  pull_subscriptions = [
    {
      name                 = "pull" // required
      ack_deadline_seconds = 20 // optional
    }
  ]
}

Inputs

Name Description Type Default Required
create_topic Specify true if you want to create a topic bool "true" no
message_storage_policy A map of storage policies. Default - inherit from organization's Resource Location Restriction policy. map <map> no
project_id The project ID to manage the Pub/Sub resources string n/a yes
pull_subscriptions The list of the pull subscriptions list(map(string)) <list> no
push_subscriptions The list of the push subscriptions list(map(string)) <list> no
topic The Pub/Sub topic name string n/a yes
topic_labels A map of labels to assign to the Pub/Sub topic map(string) <map> no

Outputs

Name Description
id The ID of the Pub/Sub topic
subscription_names The name list of Pub/Sub subscriptions
subscription_paths The path list of Pub/Sub subscriptions
topic The name of the Pub/Sub topic
topic_labels Labels assigned to the Pub/Sub topic
uri The URI of the Pub/Sub topic

Requirements

Installation Dependencies

Configure a Service Account

In order to execute this module you must have a Service Account with the following:

Roles

  • roles/pubsub.editor

Enable APIs

In order to operate with the Service Account you must activate the following APIs on the project where the Service Account was created:

  • Cloud Pub/Sub API

Service Account Credentials

You can pass the service account credentials into this module by setting the following environment variables:

  • GOOGLE_CREDENTIALS
  • GOOGLE_CLOUD_KEYFILE_JSON
  • GCLOUD_KEYFILE_JSON

See more details.