tf-gke-test/bucket/README.md

2.4 KiB

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