Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juwit/terraform-gcp-lab
⚗️ repository holding terraform modules for GCP
https://github.com/juwit/terraform-gcp-lab
Last synced: 19 days ago
JSON representation
⚗️ repository holding terraform modules for GCP
- Host: GitHub
- URL: https://github.com/juwit/terraform-gcp-lab
- Owner: juwit
- Created: 2021-04-19T09:33:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-20T15:26:42.000Z (over 3 years ago)
- Last Synced: 2024-10-06T01:41:25.934Z (about 1 month ago)
- Language: HCL
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# terraform gcp lab
This repository holds various terraform modules I use to play with GCP.
The goal of this lab is to :
* create a new GCP project
* associate it to a billing account
* create a new bucket in this project
* create a new VM in this project, and configure it to write a file in the bucket
* create a new VM template and an auto-scaling instance group using the template## pre-requisites : setting up a service account
see https://cloud.google.com/community/tutorials/managing-gcp-projects-with-terraform
The service account should be created in an "Admin" project, but must be granted organization-wide rights.
The "Admin" project should also have activated the Resource Manager API, and the Billing API:
```
gcloud services enable cloudresourcemanager.googleapis.com
gcloud services enable cloudbilling.googleapis.com
gcloud services enable iam.googleapis.com
```### creation
Terraform will need a service account for this to work.
In an "Admin Project", go to IAM > Service Accounts
Create a "terraform" service account.
Create a key for this service account, and save it as a JSON file.
Create a env var pointing to this key :
```
export GOOGLE_CREDENTIALS=terraform-admin-project-sa.json
```### add roles
In the IAM & Admin > IAM, for the Organization
Select "Add" and add the service account as a member, with the project creator role (roles/resourcemanager.projectCreator), and the billing role (roles/billing.user)