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





Create HMAC keys



Make data public google_storage_bucket_iam_member
Host a static website




What's next

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