Skip to content

Commit

Permalink
chore(app): declare variables for database
Browse files Browse the repository at this point in the history
  • Loading branch information
tericcabrel committed Sep 1, 2024
1 parent 44f0102 commit fcbb76f
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
43 changes: 43 additions & 0 deletions _infra/credentials/database_prod.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
resource "doppler_environment" "database_prod" {
project = doppler_project.database.name
slug = "prod"
name = "Production"
}

resource "doppler_config" "database_prod_config" {
project = doppler_project.database.name
environment = doppler_environment.database_prod.slug
name = "prod_database"
}

resource "doppler_service_token" "database_prod_token" {
project = doppler_project.database.name
config = doppler_config.database_prod_config.name
name = "CI Token"
access = "read"
}

variable "database_prod_secrets_map" {
type = map(string)
default = {
"ADMIN_USER" = "",
"ADMIN_PASSWORD" = "",
"DATABASE_NAME" = "",
"PORT" = "3306"
}
}

resource "doppler_secret" "database_prod_secrets" {
for_each = var.database_prod_secrets_map

project = doppler_project.database.name
config = doppler_config.database_prod_config.name
name = each.key
value = each.value

lifecycle {
ignore_changes = [
value, # Ignore changes to the secret value
]
}
}
7 changes: 6 additions & 1 deletion _infra/credentials/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ provider "doppler" {}
resource "doppler_project" "backend" {
name = "snipcode-backend"
description = "The main backend project"
}
}

resource "doppler_project" "database" {
name = "snipcode-database"
description = "The main database project"
}
7 changes: 6 additions & 1 deletion _infra/credentials/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ output "backend_prod_token_key" {
output "backend_dev_token_key" {
value = doppler_service_token.backend_dev_token.key
sensitive = true
}
}

output "database_prod_token_key" {
value = doppler_service_token.database_prod_token.key
sensitive = true
}
1 change: 1 addition & 0 deletions _infra/global/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ provider "aws" {
resource "aws_route53_zone" "hosted_zone" {
name = var.domain_name
}

0 comments on commit fcbb76f

Please sign in to comment.