bucketHow to create buckets in batches on GCP
bucketHow to create buckets in batches on GCP
[Overview] Bucket is a storage component in Google Cloud Storage that provides you with data storage. It supports diverse data types, including videos, music, images, and files in various formats, greatly meeting the needs for data storage. At the same time, it is also a visual interface where you can create and delete buckets, or open files in the interface to view their contents. This is suitable for relatively small amounts of data. If the data volume is large, it is recommended to use analytical tools for a more appropriate way to open the data.
Compared with the past when everyone created them one by one manually, this article brings you a tutorial on batch creating buckets. I hope it can help those classmates who are using buckets but don’t know how to create them in batches!
[Advantages]
- One – click creation
- Plan the name of your bucket uniformly
- Save the time for creating one by one
【Hands-on practice】
1 First, open the console page and log in to the Google Console Shell.
2 Create a working directory
Mkdir /terraform
3 Create a file
Touch/terraform/{variables.tf,terraform.tfvars,main.tf}
4 Edit various files
(1) Varriables.tfvariable "bucket_name_set" {type = list(string)}(2) terraform.tfvarsbucket_name_set = [“example-bucket-name-001”,“example-bucket-name-001”,“example-bucket-name-001”,](3) main.tfresource“google_storage_bucket””my_bucket_set”{project = “填入自己的项目名称”for_each= toset(var.bucket_name_set)name = each.valuelocation= “region填入”storage_class=”STANDARD”force_destroy= trueuniform_bucket_level_access= true}
5 Execute the generation plan entry
Terraforminitterraformplan
6 Create
terraformapply
7 Execution results


