-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Terragrunt KMS module #96
Merged
Merged
Conversation
This file contains 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
Creates the Customer Managed Keys (CMKs) that are used to encypt/decrypt CloudWatch and DynamoDB data.
Scratch: kms✅ Terraform Format: Plan: 2 to add, 0 to change, 0 to destroy Show planResource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_kms_key.cloudwatch will be created
+ resource "aws_kms_key" "cloudwatch" {
+ arn = (known after apply)
+ bypass_policy_lockout_safety_check = false
+ customer_master_key_spec = "SYMMETRIC_DEFAULT"
+ description = "CloudWatch Log Group Key"
+ enable_key_rotation = true
+ id = (known after apply)
+ is_enabled = true
+ key_id = (known after apply)
+ key_usage = "ENCRYPT_DECRYPT"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "kms:*"
+ Effect = "Allow"
+ Principal = {
+ AWS = "arn:aws:iam::722713121070:root"
}
+ Resource = "*"
+ Sid = "Enable IAM User Permissions"
},
+ {
+ Action = [
+ "kms:ReEncrypt*",
+ "kms:GenerateDataKey*",
+ "kms:Encrypt*",
+ "kms:Describe*",
+ "kms:Decrypt*",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "logs.ca-central-1.amazonaws.com"
}
+ Resource = "*"
+ Sid = ""
},
+ {
+ Action = [
+ "kms:GenerateDataKey*",
+ "kms:Decrypt",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "cloudwatch.amazonaws.com"
}
+ Resource = "*"
+ Sid = "Allow_CloudWatch_for_CMK"
},
+ {
+ Action = [
+ "kms:ReEncrypt*",
+ "kms:GenerateDataKey*",
+ "kms:Encrypt*",
+ "kms:Describe*",
+ "kms:Decrypt*",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "events.amazonaws.com"
}
+ Resource = "*"
+ Sid = "CloudwatchEvents"
},
]
+ Version = "2012-10-17"
}
)
+ tags = {
+ "CostCentre" = "forms-platform-scratch"
+ "Terraform" = "true"
}
+ tags_all = {
+ "CostCentre" = "forms-platform-scratch"
+ "Terraform" = "true"
}
}
# aws_kms_key.dynamo_db will be created
+ resource "aws_kms_key" "dynamo_db" {
+ arn = (known after apply)
+ bypass_policy_lockout_safety_check = false
+ customer_master_key_spec = "SYMMETRIC_DEFAULT"
+ description = "KMS key for DynamoDB encryption"
+ enable_key_rotation = true
+ id = (known after apply)
+ is_enabled = true
+ key_id = (known after apply)
+ key_usage = "ENCRYPT_DECRYPT"
+ policy = jsonencode(
{
+ Statement = [
+ {
+ Action = "kms:*"
+ Effect = "Allow"
+ Principal = {
+ AWS = "arn:aws:iam::722713121070:root"
}
+ Resource = "*"
+ Sid = "Enable IAM User Permissions"
},
+ {
+ Action = [
+ "kms:ReEncrypt*",
+ "kms:GenerateDataKey*",
+ "kms:Encrypt",
+ "kms:DescribeKey",
+ "kms:Decrypt",
+ "kms:CreateGrant",
]
+ Condition = {
+ StringLike = {
+ kms:ViaService = [
+ "dynamodb.*.amazonaws.com",
]
}
}
+ Effect = "Allow"
+ Principal = {
+ AWS = "arn:aws:iam::722713121070:root"
}
+ Resource = "*"
+ Sid = "Allow access through Amazon DynamoDB for all principals in the account that are authorized to use Amazon DynamoDB"
},
+ {
+ Action = [
+ "kms:List*",
+ "kms:Get*",
+ "kms:Describe*",
]
+ Effect = "Allow"
+ Principal = {
+ Service = "dynamodb.amazonaws.com"
}
+ Resource = "*"
+ Sid = "Allow DynamoDB to get information about the CMK"
},
]
+ Version = "2012-10-17"
}
)
+ tags = {
+ "CostCentre" = "forms-platform-scratch"
+ "Terraform" = "true"
}
+ tags_all = {
+ "CostCentre" = "forms-platform-scratch"
+ "Terraform" = "true"
}
}
Plan: 2 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ kms_key_cloudwatch_arn = (known after apply)
+ kms_key_dynamodb_arn = (known after apply)
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest results9 tests, 9 passed, 0 warnings, 0 failures, 0 exceptions
|
Moro-Code
approved these changes
Nov 3, 2021
This was referenced Sep 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Creates the Customer Managed Keys (CMKs) that are used to
encypt/decrypt CloudWatch and DynamoDB data.
Also includes Terraform static analysis workflow with checkov.
Ref: original source for module is 014e912
Related