Skip to content

Commit

Permalink
Password elrond from AWS secrets (#813)
Browse files Browse the repository at this point in the history
Signed-off-by: Stavros Foteinopoulos <[email protected]>
  • Loading branch information
stafot authored Feb 5, 2025
1 parent 478113b commit 6d99682
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 0 additions & 3 deletions aws/eks-customer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.41.0 |
| <a name="requirement_github"></a> [github](#requirement\_github) | ~> 6.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 2.5.1 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2.2 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.6.2 |
Expand All @@ -15,7 +14,6 @@
| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.41.0 |
| <a name="provider_github"></a> [github](#provider\_github) | ~> 6.0 |
| <a name="provider_local"></a> [local](#provider\_local) | >= 2.5.1 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 3.2.2 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.6.2 |
Expand Down Expand Up @@ -71,7 +69,6 @@
| [aws_subnets.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [aws_subnets.private-a](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [aws_subnets.public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
| [github_app_token.this](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/app_token) | data source |

## Inputs

Expand Down
3 changes: 2 additions & 1 deletion aws/elrond/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
| [aws_db_subnet_group.subnets_db](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_subnet_group) | resource |
| [aws_security_group.cnc_to_elrond_postgress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
| [aws_secretsmanager_secret.elrond](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/secretsmanager_secret) | data source |
| [aws_secretsmanager_secret_version.elrond](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/secretsmanager_secret_version) | data source |
| [terraform_remote_state.cluster](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/data-sources/remote_state) | data source |

## Inputs
Expand All @@ -37,7 +39,6 @@
| <a name="input_db_backup_window"></a> [db\_backup\_window](#input\_db\_backup\_window) | The Elrond DB backup window | `string` | n/a | yes |
| <a name="input_db_deletion_protection"></a> [db\_deletion\_protection](#input\_db\_deletion\_protection) | Whether to enable DB deletion protection or not | `bool` | `true` | no |
| <a name="input_db_maintenance_window"></a> [db\_maintenance\_window](#input\_db\_maintenance\_window) | The Elrond DB maintenance window | `string` | n/a | yes |
| <a name="input_db_password"></a> [db\_password](#input\_db\_password) | The Elrond DB password | `string` | n/a | yes |
| <a name="input_db_username"></a> [db\_username](#input\_db\_username) | The Elrond DB username | `string` | n/a | yes |
| <a name="input_elrond_apply_immediately"></a> [elrond\_apply\_immediately](#input\_elrond\_apply\_immediately) | n/a | `bool` | `false` | no |
| <a name="input_elrond_aurora_family"></a> [elrond\_aurora\_family](#input\_elrond\_aurora\_family) | n/a | `string` | `"aurora-postgresql14"` | no |
Expand Down
10 changes: 9 additions & 1 deletion aws/elrond/elrond-db.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ resource "aws_db_subnet_group" "subnets_db" {

}

data "aws_secretsmanager_secret" "elrond" {
name = format("%s-%s", var.elrond_service_name, var.environment)
}

data "aws_secretsmanager_secret_version" "elrond" {
secret_id = data.aws_secretsmanager_secret.elrond.id
}

module "aurora-cluster" {
source = "github.com/mattermost/mattermost-cloud-monitoring.git//aws/aurora-cluster?ref=v1.7.93"
cluster_identifier = var.elrond_db_cluster_identifier
Expand All @@ -70,7 +78,7 @@ module "aurora-cluster" {
engine_version = var.elrond_db_cluster_engine_version
instance_type = var.elrond_db_cluster_instance_type
username = var.db_username
password = var.db_password
password = data.aws_secretsmanager_secret_version.elrond.secret_string
iam_database_authentication_enabled = var.iam_database_authentication_enabled
final_snapshot_identifier_prefix = "elrond-final-${var.elrond_db_cluster_identifier}-${local.timestamp_now}"
skip_final_snapshot = false
Expand Down
5 changes: 0 additions & 5 deletions aws/elrond/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ variable "db_username" {
description = "The Elrond DB username"
}

variable "db_password" {
type = string
description = "The Elrond DB password"
}

variable "db_backup_retention_period" {
type = string
description = "The Elrond DB backup retention period"
Expand Down

0 comments on commit 6d99682

Please sign in to comment.