-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dsme94/encryption
Allow secrets to be encrypted with a KMS key....
- Loading branch information
Showing
6 changed files
with
61 additions
and
46 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,4 @@ | ||
data "template_file" "example" { | ||
template = file("/path/to/json") | ||
|
||
} |
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
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,7 @@ | ||
output "secret" { | ||
value = module.secret.secret | ||
} | ||
|
||
output "secret_version" { | ||
value = module.secret.secret_version | ||
} |
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 |
---|---|---|
@@ -1,44 +1,13 @@ | ||
# Variables | ||
|
||
variable "name" { | ||
description = "Name of secret to store" | ||
type = string | ||
} | ||
|
||
variable "value" { | ||
description = "Secret value to store" | ||
type = string | ||
} | ||
|
||
variable "description" { | ||
type = string | ||
default = "terraform-managed secret" | ||
} | ||
|
||
variable "tags" { | ||
description = "User-Defined tags" | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
# Resources | ||
|
||
resource "aws_secretsmanager_secret" "secret" { | ||
name_prefix = var.name | ||
tags = var.tags | ||
name = var.name | ||
tags = var.tags | ||
policy = var.policy | ||
kms_key_id = var.kms_key_id | ||
} | ||
|
||
resource "aws_secretsmanager_secret_version" "secret" { | ||
secret_id = aws_secretsmanager_secret.secret.id | ||
secret_id = aws_secretsmanager_secret.secret.id | ||
secret_string = var.value | ||
} | ||
|
||
# Outputs | ||
|
||
output "secret" { | ||
value = aws_secretsmanager_secret.secret | ||
} | ||
|
||
output "secret_version" { | ||
value = aws_secretsmanager_secret_version.secret | ||
} | ||
} |
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,9 @@ | ||
# Outputs | ||
|
||
output "secret" { | ||
value = aws_secretsmanager_secret.secret | ||
} | ||
|
||
output "secret_version" { | ||
value = aws_secretsmanager_secret_version.secret | ||
} |
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,32 @@ | ||
# Variables | ||
|
||
variable "name" { | ||
description = "Name of secret to store" | ||
type = string | ||
} | ||
|
||
variable "value" { | ||
description = "Secret value to store" | ||
type = string | ||
} | ||
|
||
variable "description" { | ||
type = string | ||
default = "terraform-managed secret" | ||
} | ||
|
||
variable "tags" { | ||
description = "User-Defined tags" | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
variable "policy" { | ||
description = "Optional. The resource policy which controls access to the secret." | ||
default = null | ||
} | ||
|
||
variable "kms_key_id" { | ||
description = "Optional. The KMS Key ID to encrypt the secret. KMS key arn or alias can be used." | ||
default = null | ||
} |