-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kamlesh
committed
Aug 20, 2019
0 parents
commit d783c5c
Showing
7 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Compiled files | ||
*.tfstate | ||
*.tfstate.backup | ||
|
||
# Module directory | ||
.terraform | ||
.idea | ||
*.iml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
repos: | ||
- repo: https://github.com/antonbabenko/pre-commit-terraform | ||
rev: v1.7.4 | ||
hooks: | ||
- id: terraform_fmt | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.0.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: trailing-whitespace | ||
- id: check-yaml | ||
- id: check-added-large-files |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# terraform-aws-kms | ||
> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
module "kms_key" { | ||
source = "git::https://github.com/clouddrove/terraform-aws-kms.git?ref=tags/0.11.0" | ||
name = "kms" | ||
application = "clouddrove" | ||
environment = "test" | ||
description = "KMS key for chamber" | ||
deletion_window_in_days = 30 | ||
enable_key_rotation = "true" | ||
alias = "alias/parameter_store_key" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module "label" { | ||
source = "git::https://github.com/clouddrove/terraform-lables.git?ref=tags/0.11.0" | ||
name = "${var.name}" | ||
application = "${var.application}" | ||
environment = "${var.environment}" | ||
} | ||
|
||
resource "aws_kms_key" "default" { | ||
description = "${var.description}" | ||
deletion_window_in_days = "${var.deletion_window_in_days}" | ||
enable_key_rotation = "${var.enable_key_rotation}" | ||
tags = "${module.label.tags}" | ||
} | ||
|
||
resource "aws_kms_alias" "default" { | ||
name = "${coalesce(var.alias, format("alias/%v", module.label.id))}" | ||
target_key_id = "${aws_kms_key.default.id}" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
output "key_arn" { | ||
value = "${aws_kms_key.default.arn}" | ||
description = "Key ARN" | ||
} | ||
|
||
output "key_id" { | ||
value = "${aws_kms_key.default.key_id}" | ||
description = "Key ID" | ||
} | ||
|
||
output "alias_arn" { | ||
value = "${aws_kms_alias.default.arn}" | ||
description = "Alias ARN" | ||
} | ||
|
||
output "alias_name" { | ||
value = "${aws_kms_alias.default.name}" | ||
description = "Alias name" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
variable "application" { | ||
type = "string" | ||
description = "Application (e.g. `cp` or `clouddrove`)" | ||
} | ||
|
||
variable "environment" { | ||
type = "string" | ||
description = "Environment (e.g. `prod`, `dev`, `staging`)" | ||
} | ||
|
||
variable "name" { | ||
type = "string" | ||
description = "name (e.g. `test`)" | ||
} | ||
|
||
variable "delimiter" { | ||
type = "string" | ||
default = "-" | ||
description = "Delimiter to be used between `namespace`, `stage`, `name` and `attributes`" | ||
} | ||
|
||
variable "attributes" { | ||
type = "list" | ||
default = [] | ||
description = "Additional attributes (e.g. `1`)" | ||
} | ||
|
||
variable "tags" { | ||
type = "map" | ||
default = {} | ||
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)" | ||
} | ||
|
||
variable "deletion_window_in_days" { | ||
default = 10 | ||
description = "Duration in days after which the key is deleted after destruction of the resource" | ||
} | ||
|
||
variable "enable_key_rotation" { | ||
default = "true" | ||
description = "Specifies whether key rotation is enabled" | ||
} | ||
|
||
variable "description" { | ||
type = "string" | ||
default = "Parameter Store KMS master key" | ||
description = "The description of the key as viewed in AWS console" | ||
} | ||
|
||
variable "alias" { | ||
type = "string" | ||
default = "" | ||
description = "The display name of the alias. The name must start with the word `alias` followed by a forward slash" | ||
} |