Skip to content

Commit

Permalink
feat: extract db ca from terraform for shared databases (#26)
Browse files Browse the repository at this point in the history
* feat: export db ca from terraform #24

* fix: expose db ca for shared databases

* chore: fix typo in comment
  • Loading branch information
indrif authored May 3, 2022
1 parent e0dd7c2 commit bfbc573
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions docs/Develop_GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ Major libraries used:

## Structure

- `bin/` - contains all the scripts
- `lib/` - all common code used by the scripts
- `docs/` - the documentation
- `kubernetes/` - all rendered Kubernetes resources. Is automatically created by the scripts.
- `projects/` - this is the central part for project definitions and the source for all files generated in this repo. To provision a new project a new folder is added here. This is basically the only thing that should be modified by non-contributors.
- `scripts/` - contains all the scripts
- `templates/` - all Handlebars templates grouped by category
- `terraform/` - rendered Terraform files and modules that is used to manage infrastructure
- `users/` - a list of all unique users currently in use in all the projects
Expand Down
4 changes: 2 additions & 2 deletions scripts/lib/render-projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export const renderProjects = (
});
});

// Render terraform for stages
stages.forEach((stage, index) => {
// Render projects for stages
stages.forEach((stage) => {
console.log(`Rendering templates for stage ${stage}...`);
const context = {
...resources[stage],
Expand Down
4 changes: 4 additions & 0 deletions templates/terraform/db.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ resource "digitalocean_database_cluster" "{{stage}}-shared" {
region = var.region
node_count = 1
}

data "digitalocean_database_ca" "{{stage}}-db-ca" {
cluster_id = digitalocean_database_cluster.{{stage}}-shared.id
}
1 change: 1 addition & 0 deletions templates/terraform/project_main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ output "project__{{tfName}}" {
port: digitalocean_database_cluster.{{stage}}-shared.port
host: digitalocean_database_cluster.{{stage}}-shared.host
private_host: digitalocean_database_cluster.{{stage}}-shared.private_host
ca: data.digitalocean_database_ca.{{stage}}-db-ca.certificate
})
}
shared_databases_users = {
Expand Down

0 comments on commit bfbc573

Please sign in to comment.