Skip to main content
Use this page if you manage Google Cloud with Terraform. It covers the Google Cloud side of GCS forwarding: the bucket, the service account your Macs upload with, and the values your rollout needs. When you finish, continue with your rollout guide from the step after its Google Cloud setup. The gcloud steps in the rollout guides create the same resources. Follow either one.
Want Asymptote to read this bucket for your dashboard? Follow Asymptote with Your Own Cloud Storage Bucket instead. It uses this module together with the Asymptote reader module.

What you’ll set up

  • A new Cloud Storage bucket just for Beacon, with uniform bucket-level access, public access prevention enforced, versioning, and optionally your Cloud KMS key. The module always creates its own bucket and does not manage existing ones.
  • beacon-endpoint-writer, a service account that can create objects below your Beacon prefix and can’t list, read, or delete them.
  • beacon-endpoint-reader, a read-only service account for checking uploads.
Every Mac’s forwarder writes both of Beacon’s logs to the bucket:
The module is in the Beacon repository at terraform/gcs.

Before you start

1. Add the module

Pick a root prefix such as beacon-prod. Beacon adds runtime/ and inventory/ below it, so don’t put either in the prefix. Create a main.tf in a new directory, or add these blocks to your existing configuration. Change the project, location, bucket name, and prefix:
main.tf
ref pins the module to a Beacon release. The module first shipped in v1.3.38, and any later release tag works too.

2. Create the bucket and service accounts

Review the plan and type yes. It’s working when the apply ends with:
The module enables the Cloud Storage and IAM APIs on the project if they’re off, and leaves them on if you destroy it later. Save the values as shell variables for the next steps. The rollout guides use the same names:

3. Create the writer’s key

The module doesn’t create keys by default, because Terraform would store the private key in its state file. Create the key with gcloud:
Deliver the JSON file to each Mac with your MDM’s secret or file delivery, to a root-owned path outside Beacon’s directories, with mode 0600. Your rollout guide covers this step for your MDM. Then delete the local copy.

4. Give the values to your rollout

Then continue with your rollout:

5. Confirm delivery

After the forwarder is running on a Mac, write a test event there:
The forwarder uploads in batches, so allow up to five minutes. Then list the objects as the reader, because the writer can’t list the bucket. Impersonating the reader needs roles/iam.serviceAccountTokenCreator on it; you can also list with your own identity if it can read the bucket.

Options

Set any of these in the module "beacon_gcs" block and run terraform apply again. Every input is described in variables.tf.
The key becomes the bucket’s default encryption. Cloud Storage encrypts with its own service agent, so the module grants that agent roles/cloudkms.cryptoKeyEncrypterDecrypter on the key. Set grant_kms_to_storage_agent = false if you manage the key’s IAM elsewhere. The writer needs no KMS permission.
Objects below the prefix are deleted a year after upload. Versioning is on by default, so a deleted or replaced object stays recoverable for noncurrent_version_expiration_days (default 30). Set versioning_enabled = false to turn versioning off.
Read it with terraform output -raw writer_private_key | base64 --decode > beacon-gcs-writer.json after adding a matching output block. The private key is stored in Terraform state, so use this only when your state is encrypted and access is restricted.
  • writer_account_id and reader_account_id rename the service accounts.
  • labels labels the bucket.
  • enable_apis = false skips enabling the APIs, for projects where they’re managed elsewhere.

Outputs

Rotate the writer key

Rotation happens outside Terraform. Create a new key, deliver it to every Mac, restart the forwarder, confirm a new object arrives, and then delete the old key. Your rollout guide has the exact commands under credential rotation.

Remove

  1. Remove the forwarder from your Macs. Uninstalling Beacon removes it.
  2. Run terraform destroy. Deleting the writer service account also deletes its keys. Destroy stops at a bucket that still holds objects. To delete the telemetry too, set force_destroy = true, run terraform apply, and then destroy.

Troubleshooting

Someone else, in any project, already has a bucket with that name. Choose another bucket_name.
Check that the forwarder’s bucket and prefix match the Terraform outputs exactly. The writer can only create objects below <prefix>/.

Claude with Jamf and GCS

Roll out Beacon with Jamf Pro and forward to Cloud Storage.

Claude with Rippling and GCS

Roll out Beacon with Rippling and forward to Cloud Storage.

AWS S3 with Terraform

The same setup for an S3 bucket.

Object storage forwarding

Forward to S3, Cloud Storage, or both from one Mac.