Skip to content

dod-iac/terraform-aws-sqs-kms-key

Repository files navigation

Usage

Creates a KMS Key for use with AWS SQS.

module "sqs_kms_key" {
  source = "dod-iac/sqs-kms-key/aws"

  name = format("alias/app-%s-sqs-%s", var.application, var.environment)
  description = format("A KMS key used to encrypt messages in SQS queues for %s:%s.", var.application, var.environment)
  principals = [aws_iam_user.main.arn]
  tags = {
    Application = var.application
    Environment = var.environment
    Automation  = "Terraform"
  }
}

Terraform Version

Terraform 0.13. Pin module version to ~> 1.0.0 . Submit pull-requests to master branch.

Terraform 0.11 and 0.12 are not supported.

License

This project constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. However, because the project utilizes code licensed from contributors and other third parties, it therefore is licensed under the MIT License. See LICENSE file for more information.

Requirements

Name Version
terraform >= 0.13
aws >= 3.0, < 5.0

Providers

Name Version
aws >= 3.0, < 5.0

Modules

No modules.

Resources

Name Type
aws_kms_alias.sqs resource
aws_kms_key.sqs resource
aws_caller_identity.current data source
aws_iam_policy_document.sqs data source
aws_partition.current data source
aws_region.current data source

Inputs

Name Description Type Default Required
description n/a string "A KMS key used to encrypt messages in SQS queues." no
key_deletion_window_in_days Duration in days after which the key is deleted after destruction of the resource, must be between 7 and 30 days. string 30 no
name The display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/). string n/a yes
principals AWS Principals that can use this KMS key. Use ["*"] to allow all principals. list(string) [] no
services Services that can use this KMS key. list(string)
[
"events.amazonaws.com",
"s3.amazonaws.com",
"sns.amazonaws.com"
]
no
tags Tags applied to the KMS key. map(string) {} no

Outputs

Name Description
aws_kms_alias_arn The Amazon Resource Name (ARN) of the key alias.
aws_kms_alias_name The display name of the alias.
aws_kms_key_arn The Amazon Resource Name (ARN) of the key.