Terraform support for Cloud Storage

Terraform is an infrastructure-as-code (IaC) tool that you can use to provision resources and permissions for Cloud Storage. Terraform is integrated with Cloud Shell, and Cloud Shell automatically authenticates Terraform.

When you use Terraform with Cloud Storage, you create a Terraform configuration file that describes your desired infrastructure. When you apply the configuration, Terraform creates an execution plan and performs the operations needed to provision your infrastructure. For example, you can use Terraform to create storage buckets, upload objects, and control the lifecycle of those objects.

Terraform resources for Cloud Storage

The following table lists the Terraform resources that are currently available for Cloud Storage, with links to Terraform configuration samples in Cloud Storage documentation:

Terraform configuration sample Terraform resource
Create buckets google_storage_bucket
Get bucket metadata google_storage_bucket
Upload objects google_storage_bucket_object
Get object metadata google_storage_bucket_object
Manage object life cycles google_storage_bucket
Create Pub/Sub notifications

google_pubsub_topic_iam_binding

google_pubsub_topic

google_storage_bucket

google_storage_notification

Create HMAC keys

google_service_account

google_storage_hmac_key

Make data public google_storage_bucket_iam_member
Host a static website

google_storage_bucket_access_control

google_storage_bucket_object

What's next

Complete the Terraform quickstart for Cloud Storage to get a quick understanding of how to provision Cloud Storage resources.