Google Cloud KMS Module#
This module manages a KMS keyring and its keys. It is a wrapper around the official Google Cloud Foundation Fabric KMS module.
It also supports creating a binary authorization attestor and an associated container analysis note.
Compatibility#
This module has been tested using Terraform v1.12.2
Usage#
Example with Binary Authorization Attestor#
module "kms" {
source = "github.com/<org>/gcp-terraform-modules//modules/terraform-google-kms?ref=vX.Y.Z"
project_id = "acme-prod-shared-vpc"
keyring = {
location = "me-west1"
name = "kms-module-00001"
}
create_attestor = true
keys = {
"sign-images-00001" = {
purpose = "ASYMMETRIC_SIGN"
version_template = {
algorithm = "EC_SIGN_P256_SHA256"
protection_level = "SOFTWARE"
}
}
}
}
Basic Example#
module "kms" {
source = "github.com/<org>/gcp-terraform-modules//modules/terraform-google-kms?ref=vX.Y.Z"
project_id = "your-gcp-project-id"
keyring = {
name = "my-keyring"
location = "global"
}
keys = {
"my-key" = {
rotation_period = "86400s"
}
}
}
Software#
The following dependencies must be available:
- Terraform >= 1.0.0
- Terraform Provider for GCP plugin >= v6.28.0
Service Account#
User or service account credentials with the following roles must be used to provision the resources of this module:
- Cloud KMS Admin:
roles/cloudkms.admin
APIs#
A project with the following APIs enabled must be used to host the resources of this module:
- Cloud Key Management Service (KMS) API:
cloudkms.googleapis.com - Binary Authorization API:
binaryauthorization.googleapis.com(if using binary authorization attestor) - Container Analysis API:
containeranalysis.googleapis.com(if using binary authorization attestor)
License#
This module is covered by a commercial license. Please see LICENSE for details.
Support#
This module is developed and maintained by MyOps Limited. For any support inquiries, please contact us at info@myops.co.il.
Requirements#
| Name | Version |
|---|---|
| terraform | ~> 1 |
| >= 6.28.0, < 7.0.0 | |
| time | >= 0.9.1 |
Providers#
| Name | Version |
|---|---|
| >= 6.28.0, < 7.0.0 | |
| time | >= 0.9.1 |
Modules#
| Name | Source | Version |
|---|---|---|
| kms | github.com/GoogleCloudPlatform/cloud-foundation-fabric//modules/kms | v42.0.0 |
Resources#
| Name | Type |
|---|---|
| google_binary_authorization_attestor.attestor | resource |
| google_container_analysis_note.note | resource |
| time_sleep.wait_for_key_version | resource |
| google_kms_crypto_key_version.version | data source |
Inputs#
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| create_attestor | Whether to create binary authorization attestor or not | bool |
false |
no |
| iam | Keyring IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) |
{} |
no |
| iam_bindings | Authoritative IAM bindings in {KEY => {role = ROLE, members = [], condition = {}}}. Keys are arbitrary. | map(object({ |
{} |
no |
| iam_bindings_additive | Keyring individual additive IAM bindings. Keys are arbitrary. | map(object({ |
{} |
no |
| import_job | Keyring import job attributes. | object({ |
null |
no |
| keyring | Keyring attributes. | object({ |
n/a | yes |
| keyring_create | Set to false to manage keys and IAM bindings in an existing keyring. | bool |
true |
no |
| keys | Key names and base attributes. Set attributes to null if not needed. | map(object({ |
{} |
no |
| project_id | Project id where the keyring will be created. | string |
n/a | yes |
| tag_bindings | Tag bindings for this keyring, in key => tag value id format. | map(string) |
{} |
no |
Outputs#
| Name | Description |
|---|---|
| attestor | n/a |
| attestor_public_key | n/a |
| kms | KMS Outputs |