Skip to content

babbel/terraform-aws-secretsmanager-for-rollbar-access-tokens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SecretsManager for Rollbar Project Access Tokens

This module creates a SecretsManager and stores the configured Rollbar project access tokens in it.

This is useful in order to load the Rollbar project access tokens into ECS via containerDefinitions.secrets.valueFrom.

Usage

module "secretsmanager-for-rollbar-access-tokens" {
  source  = "babbel/secretsmanager-for-rollbar-access-tokens/aws"
  version = "~> 2.1"

  name_prefix = "example"

  rollbar_tokens = values(rollbar_project_access_token.example)
}

In the ECS task definition, you can now define environment variables referencing the SecretsManager:

resource "aws_ecs_task_definition" "example" {
  ...

  container_definitions = jsonencode([{
    ...

    secrets = [{
      name  = "ROLLBAR_ACCESS_TOKEN"
      value = "${module.secretsmanager-for-rollbar-access-tokens.secretsmanager_secret.arn}:${rollbar_project_access_token.example.name}::"
    }]

    ...
  }])

  ...
}

Please also make sure that you grant permissions on the secretsmanager:GetSecretValue action for the SecretsManager on the ECS task execution IAM role.