Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

kms-key

This module provisions a KMS key with alias.

Usage example

module "context" {
  source = "github.com/spaceteams/terraform-space-context"

  namespace   = "spaceteams"
  environment = "ci"
}

module "kms_key" {
  source = "github.com/spaceteams/terraform-aws-modules/components/kms-key"

  name = "kms-key"
  alias = "kms-key"

  context = module.context
}

output "kms_key_id" {
  value = module.kms_key.key_id
}

Optional Inputs

The following input variables are optional (have default values):

Description: The alias aka. the human readable name of this key that will be shown when being referenced by other services, eg. in the AWS console. If not specified, the context label will be used instead.

Type: string

Default: null

Description: Set this to pass down a complete context.
This is usually used to pass down the 'outer' context,
ie. the context of module invoking this one.
See terraform-space-context documentation
for details on how the context is commonly used.
All context values can be override via inputs on the module level.

Type: any

Default:

{
  "enabled": true,
  "environment": null,
  "iam_permission_boundary": null,
  "name": null,
  "namespace": null,
  "stage": null,
  "suffix": [],
  "tags": {}
}

Description: AWS KMS keys are cannot be deleted immediately. Instead, AWS will mark them for deletion for the number of days specified here, only after which the key will be permanently deleted. Until then, the key may be restored at any point.

Type: number

Default: 30

Description: The description of the key.

Type: string

Default: null

Description: Set this to true for AWS to rotate the encryption material automatically on a regular basis.
Key rotation does not result in data being unaccessable that uses the old encryption material.
AWS will keep all of the old material available for decryption indefinately.
The new encryption material will only be used to encrypt new data.

It is highly recommended to keep this enabled.

Type: bool

Default: true

Description: Specifies the intended use of the key.

Type: string

Default: null

Outputs

The following outputs are exported:

Description: The ARN of the alias associated with the KMS key

Description: The alias name associated with the KMS key

Description: The ARN of the KMS key

Description: The ID of the KMS key