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:
It’s working when gcloud prints created key [...]. Your rollout guide puts the file on each Mac, root-owned with mode 0600, outside Beacon’s directories. Google rejects a brand-new key for up to a minute, so give it a minute before a Mac first uses it.

Allow service-account keys

If gcloud says Key creation is not allowed on this service account, your Google Cloud organization blocks service-account keys, which new organizations do by default. Allow them in this project only. It needs the Organization Policy Administrator role on the organization. Add this to main.tf and run terraform apply:
Or with gcloud:
The rest of your organization still blocks keys. The change takes a minute or two to apply. Then create the key again.

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 with your own identity, which needs read access to the bucket, such as Storage Object Viewer. The writer can’t list the bucket.
To list as the read-only service account instead, give yourself roles/iam.serviceAccountTokenCreator on it and add --impersonate-service-account "$BEACON_GCS_READER_EMAIL". A new grant can take a few minutes to work.

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.
Add an output for it. Terraform refuses to output the key unless it’s marked sensitive:
After terraform apply, write it to a file with (umask 077; terraform output -raw writer_private_key | base64 --decode > beacon-gcs-writer.json). 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. To delete the bucket along with the telemetry in it, set force_destroy = true in the module and run terraform apply first. Without it, destroy removes the service accounts and stops at the bucket while it holds objects.
  3. Run terraform destroy. Deleting the writer service account also deletes its keys.

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>/.

Jamf and GCS

Roll out Beacon to Claude Code, Codex, and Cursor users 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.