How to create GCS bucket with versioning using Terraform

0 votes

Hi Team,

I am new to the GCP cloud. I want to create a GCS bucket using Terraform. Can anyone tell me, how can I create that?

Dec 1, 2020 in Terraform by MD
• 95,460 points
1,654 views

1 answer to this question.

0 votes

Hi@MD,

You can create a new bucket in Google cloud storage service (GCS). Once a bucket has been created, its location can't be changed.

resource "google_storage_bucket" "static-site" {
  name          = "image-store.com"
  location      = "EU"
  force_destroy = true

  uniform_bucket_level_access = true

  website {
    main_page_suffix = "index.html"
    not_found_page   = "404.html"
  }
  cors {
    origin          = ["http://image-store.com"]
    method          = ["GET", "HEAD", "PUT", "POST", "DELETE"]
    response_header = ["*"]
    max_age_seconds = 3600
  }
}
answered Dec 1, 2020 by akhtar
• 38,260 points

Related Questions In Terraform

0 votes
1 answer

How to create a folder in S3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket_object resource to create one ...READ MORE

answered Jun 11, 2020 in Terraform by MD
• 95,460 points
10,962 views
0 votes
1 answer

How to create one s3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket resources to create ...READ MORE

answered Jun 12, 2020 in Terraform by MD
• 95,460 points
3,907 views
0 votes
1 answer

How to create one S3 bucket in AWS using Terraform?

Hi@akhtar, You need to set aws provider name ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,460 points
1,404 views
0 votes
1 answer

How to create a folder inside S3 Bucket using Terraform code?

Hi@akhtar, You can create a folder at the ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,460 points
2,953 views
0 votes
1 answer
0 votes
1 answer

Error:No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'.

Hi@akhtar, You are trying to connect the GCP ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,460 points
4,645 views
0 votes
1 answer

How to use GCP provider in Terraform?

Hi@akhtar, Terraform supports many providers to deploy the ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,460 points
709 views
0 votes
1 answer

How to launch an instance in GCP using Terraform?

Hi@akhtar, You can use the google_compute_instance resource in ...READ MORE

answered Sep 12, 2020 in Terraform by MD
• 95,460 points
839 views
+2 votes
1 answer

How to create a workspace in terraform?

Hi@MD, Terraform has a command named terraform workspace. ...READ MORE

answered Aug 17, 2020 in Terraform by akhtar
• 38,260 points
999 views
0 votes
1 answer

How to create an EFS in AWS from Terraform Code?

Hi@MD, You can use aws_efs_file_system resource in Terraform. ...READ MORE

answered Sep 9, 2020 in Terraform by akhtar
• 38,260 points
1,366 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP