agones.dev/agones@v1.53.0/build/terraform/e2e/state-bucket/main.tf (about) 1 // Copyright 2023 Google LLC All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 16 // Run: 17 // terraform apply -var project="<YOUR_GCP_ProjectID>" 18 19 // If you are getting `Error: googleapi: Error 409: Your previous request to create the named bucket 20 // succeeded and you already own it., conflict` this means that your local tfstate file has 21 // divereged from the tfstate file in Google Cloud Storage (GCS). To use the GCS version of the 22 // tfstate, delete your local .terraform and .tfstate files. You may need to run 23 // `sudo chown -R yourusername .` to be able to delete them. Then navigate to this directory and run 24 // `terraform init`. Pull in the tfstate file from gcloud with 25 // `terraform import google_storage_bucket.default "<YOUR_GCP_ProjectID>"-e2e-infra-bucket-tfstate`. 26 27 // # GCS bucket for holding the Terraform state of the e2e Terraform config. 28 29 terraform { 30 required_version = ">= 1.0.0" 31 required_providers { 32 google = { 33 source = "hashicorp/google" 34 version = "~> 4.25.0" 35 } 36 } 37 } 38 39 variable "project" {} 40 41 resource "google_storage_bucket" "default" { 42 project = var.project 43 name = "${var.project}-e2e-infra-bucket-tfstate" 44 force_destroy = false 45 uniform_bucket_level_access = true 46 location = "US" 47 storage_class = "STANDARD" 48 versioning { 49 enabled = true 50 } 51 }