Skip to content

Terraform module for providing read and write access to the AWS Secret Manager values

License

Notifications You must be signed in to change notification settings

Infrastrukturait/terraform-aws-secret-manager

Repository files navigation

terraform-aws-secret-manager

WeSupportUkraine

About

Terraform module for providing read and write to AWS Secret Manager. AWS Secrets Manager helps you protect secrets needed to access your applications, services, and IT resources. The service enables you to easily rotate, manage, and retrieve database credentials, API keys, and other secrets throughout their lifecycle.

License

License: MIT

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Source: <https://opensource.org/licenses/MIT>

See LICENSE for full details.

Authors

Documentation

Requirements

Name Version
terraform >= 0.14
aws >= 2.0.0

Modules

No modules.

Resources

Name Type
aws_secretsmanager_secret.this resource
aws_secretsmanager_secret_version.this resource

Inputs

Name Description Type Default Required
description Description of secret. string "" no
kms_key_id KMS Key ID to encrypt the secret. KMS key arn or alias can be used. string "" no
name Name of secret to store. string n/a yes
policy Resource IAM policy which controls access to the secret. string "" no
tags Resource tags. map(string) {} no
value Secret value to store. string "" no
values Secrets maps to store. map(string) {} no

Outputs

Name Description
arn AWS Secret Manager secret ARN
id AWS Secret Manager secret ID

Examples

locals {
  kms_key_id = var.kms_key_id == "" ? module.kms_key[0].key_arn : var.kms_key_id
}

module "app_prod_label" {
  source  = "cloudposse/label/null"
  version = "v0.25.0"

  namespace  = "app"
  stage      = "prod"
  name       = "prod-app"
  attributes = ["private"]
  delimiter  = "-"

  tags = {
    "BusinessUnit" = "XYZ",
  }
}

module "kms_key" {
  count   = var.kms_key_id == "" ? 1 : 0
  source  = "Infrastrukturait/kms-key/aws"
  version = "0.1.0"

  description = var.description
  tags        = module.app_prod_label.tags
}

module "secret" {
  source = "../../"

  name        = var.name
  values      = var.values
  description = var.description

  kms_key_id = local.kms_key_id

  tags = merge(
    var.tags,
    module.app_prod_label.tags
  )
}

About

Terraform module for providing read and write access to the AWS Secret Manager values

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages