Created
January 1, 2022 10:30
-
-
Save mr-pascal/dd01f728a0a7b700feee3526391435a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| terraform { | |
| required_providers { | |
| google = { | |
| source = "hashicorp/google" | |
| version = "4.5.0" | |
| } | |
| } | |
| } | |
| provider "google" {} | |
| resource "google_project_service" "kms_api" { | |
| ## Enabling GCP KMS API | |
| project = var.project | |
| service = "cloudkms.googleapis.com" | |
| disable_on_destroy = false | |
| } | |
| resource "google_kms_key_ring" "my_key_ring" { | |
| # Create the key ring on GCP | |
| project = var.project | |
| name = "sops-demo" | |
| location = "global" | |
| depends_on = [ | |
| google_project_service.kms_api] | |
| } | |
| resource "google_kms_crypto_key" "my_crypto_key" { | |
| # Add a new create to the key ring | |
| name = "my-encryption-key" | |
| key_ring = google_kms_key_ring.my_key_ring.id | |
| } | |
| variable "project" { | |
| description = "The GCP project" | |
| type = string | |
| default = "<YOUR_GCP_PROJECT>" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment