Skip to content

Commit

Permalink
feat: add terraform to load and deploy secrets
Browse files Browse the repository at this point in the history
Refs: OJ-2723
  • Loading branch information
surajkumar committed Dec 18, 2024
1 parent d448466 commit c40f514
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions infrastructure/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
terraform {
required_providers {
sops = {
source = "carlpett/sops"
version = "= 1.1.1"
}
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

data "sops_file" "primary" {
source_file = "secrets.yaml"
}

locals {
secrets_primary = yamldecode(data.sops_file.primary.raw)
}

resource "aws_secretsmanager_secret" "example_secret" {
name = "Example"
description = "This was deployed via Terraform and secret was in SOPS"
}

resource "aws_secretsmanager_secret_version" "example_secret_version" {
secret_id = aws_secretsmanager_secret.example_secret.id
secret_string = local.secrets_primary.Example
}

output "example_secret_arn" {
value = aws_secretsmanager_secret.example_secret.arn
}

0 comments on commit c40f514

Please sign in to comment.