GCP
Keyper Configuration¶
To deploy to the GCP stack, first create GCP provider configuration in lib/src/main/resources/app.yaml
:
Create Resource Admin Service Account¶
-
Create Service Account for Terraform:
-
Add
roles/cloudkms.admin
to the service account:SERVICE=keyper PROJECT_ID=$(gcloud config get-value project) gcloud projects add-iam-policy-binding $PROJECT_ID \ --member "serviceAccount:$SERVICE-cdktf-sa@$PROJECT_ID.iam.gserviceaccount.com" \ --role "roles/cloudkms.admin"
You can also verify it by running:
-
Add
roles/iam.serviceAccountAdmin
to the service account: -
Create and download the key:
Make sure you don't commitgcloud iam service-accounts keys create .cdktf-sa-key.json \ --iam-account "$SERVICE-cdktf-sa@$PROJECT_ID.iam.gserviceaccount.com"
.cdktf-sa-key.json
to github. -
Set ENV
GOOGLE_CLOUD_KEYFILE_JSON
to pathYour CI/CD pipeline will be able to use this role to create/delete GCP KMS resources.
Add GCS Permission¶
If you are using remote Terraform state backend, you will also need to add GCS permission to the role
SERVICE=keyper
PROJECT_ID=$(gcloud config get-value project)
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member "serviceAccount:$SERVICE-cdktf-sa@$PROJECT_ID.iam.gserviceaccount.com" \
--role "roles/storage.objectUser"
If the bucket you plan on using for remote Terraform state doesn't exist yet, create it as well.