tf-gke-test/bucket
Aleksei Krugliak 4f58bc6b17 add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00
..
README.md add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00
main.tf add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00
outputs.tf add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00
providers.tf add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00
variables.tf add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00
versions.tf add bucket and private-cluster-module 2024-09-01 15:19:36 +04:00

README.md

bucket

You should be an admin/owner of your sandbox or have enougth permissions to create a bucket.

If you use a lot of accounts and specific IAM rules, you can check the permissions of the user with the following command:

gcloud projects get-iam-policy <GCP_PROJECT> --format=json | jq '.bindings[] | select(.members[] | contains("user:<YOUR@gmail.com>"))'

"role": "roles/owner" would be great for you.

How to use the code

  1. Create terraform.tfvars file with a few variables
project          = "your-gcp-project"
iam_user_email   = "your@gmail.com"

region is optional.

  1. Create bucket

All commands will be applied via Terraform 1.8.0 or via OpenTofu, the same version. I use alias t for the commands.

t init
t apply
  1. Destrouy bucket sfter your tests
t destroy

Requirements

Name Version
terraform ~>1.8.0
google ~>5.41.0

Providers

Name Version
google 5.41.0

Modules

Name Source Version
bucket terraform-google-modules/cloud-storage/google//modules/simple_bucket ~> 6.0

Resources

Name Type
google_client_config.default data source

Inputs

Name Description Type Default Required
iam_user_email Your gcloud account string "demo@gmail.com" no
project Google Project to create resources in string "demo" no
region The region to host the cluster in string "europe-west1" no

Outputs

Name Description
gcloud_bucket_link Bucket web ui link
project GCloud Project ID
region GCloud Region