Managing Google Cloud Pub/Sub Log Sources with Terraform (Beta)

Manage Google Cloud Pub/Sub log sources as code in Terraform

Overview

Managing Google Cloud Pub/Sub log sources with Terraform is in open beta starting with Panther version 1.121, and is available to all customers. Please share any bug reports and feature requests with your Panther support team.

You can define your Google Cloud Pub/Sub log source in Terraform using the Panther Terraform provider.

Other methods to create a Pub/Sub log source include using the Panther API directly and manual creation in the Panther Console.

How to define your Panther Pub/Sub log source in Terraform

The following sections outline how to define your Pub/Sub log source in HashiCorp Configuration Language (HCL).

Prerequisite

Step 1: Choose an authentication method

  • Select an authentication method for your Pub/Sub source from the options listed on Pub/Sub Source.

The authentication method you select will determine the variables you define in Step 2, below.

Step 2: Define variables

  • Define a variables.tf file with the Panther variables shown in the code block below.

Authentication method-specific variables

In your variables.tf file, include the values in the Additional variables column below for the authentication method you chose in Step 1.

Authentication method
credentials_type value
Additional variables

Service account authentication

service_account

credentials (JSON keyfile content)

Workload Identity Federation authentication

wif

credentials (credential configuration file content), project_id

Step 3: Provide values for the defined variables

  • Add a *.tfvars file that assigns values to the variables you defined in Step 2. Note that to complete this section, you will need the API URL and token outlined in the Prerequisite section.

    • Your panther_api_url value should be your root API URL. This is either:

Step 4: Define the Terraform provider

  • Add the Panther Terraform provider.

Step 5: Define Panther Pub/Sub log source

The following HCL configuration defines the Pub/Sub log source in Panther.

Last updated

Was this helpful?