Moving objects from one GCS bucket to another Bucket using Terraform

1.3k views Asked by At

I'd like to use Terraform to move multiple GCS bucket objects from one bucket to another bucket to a different location.

I read through Terraform documentation but I couldn't find anything substantial.

1

There are 1 answers

3
Donnald Cucharo On

Terraform for Cloud Storage provider only handles creation of object. What you can do as a workaround is to use Terraform with Storage Transfer Service which schedules a job that transfers multiple objects to a GCS bucket which either came from AWS S3 or another GCS.

Since this is a GCS to GCS transfer, you can take note of:

  1. Under transfer spec block, only specify the gcs_data_source to indicate that it is a GCS to GCS transfer.
  2. The schedule block specifies the time when the transfer will start. If you intend to execute it just once, you can specify the schedule_end_date immediately.

The Storage Transfer Service feature also offers guide through the Google Cloud Console should you want to try it out: https://cloud.google.com/storage-transfer/docs/create-manage-transfer-console#configure