Skip to content

Commit

Permalink
terraform 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamlesh committed Aug 20, 2019
0 parents commit d783c5c
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Compiled files
*.tfstate
*.tfstate.backup

# Module directory
.terraform
.idea
*.iml
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# terraform-aws-kms
>
14 changes: 14 additions & 0 deletions examples/example.tf
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"
}
18 changes: 18 additions & 0 deletions main.tf
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}"
}
19 changes: 19 additions & 0 deletions outputs.tf
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"
}
54 changes: 54 additions & 0 deletions variables.tf
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"
}

0 comments on commit d783c5c

Please sign in to comment.