Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrampeter committed May 21, 2024
1 parent fb66368 commit 468cc39
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 42 deletions.
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ locals {
username = null
parameters = null
}
) : try(
) : try(
module.database[0],
{
name = null
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ module "aurora_database" {
source = "./modules/aurora_database_cluster"
count = var.enable_aurora ? 1 : 0

engine_version = var.aurora_postgres_engine_version
db_size = var.aurora_db_size
db_backup_retention = var.db_backup_retention
db_backup_retention = var.aurora_db_backup_retention
db_backup_window = var.db_backup_window
db_name = var.db_name
db_parameters = var.db_parameters
db_username = var.db_username
engine_version = var.aurora_postgres_engine_version
friendly_name_prefix = var.friendly_name_prefix
network_id = local.network_id
network_private_subnet_cidrs = var.network_private_subnet_cidrs
Expand Down
19 changes: 10 additions & 9 deletions modules/aurora_database_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@ resource "aws_rds_cluster" "aurora_postgresql" {
availability_zones = slice(data.aws_availability_zones.available.names, 0, 3)

cluster_identifier = "${var.friendly_name_prefix}-tfe"
cluster_members = var.cluster_members
cluster_members = var.cluster_members
# no special characters allowed
database_name = var.db_name
db_subnet_group_name = aws_db_subnet_group.tfe.name
delete_automated_backups = true
deletion_protection = false
engine = "aurora-postgresql"
engine_version = var.engine_version

kms_key_id = var.kms_key_id
database_name = var.db_name
db_subnet_group_name = aws_db_subnet_group.tfe.name
delete_automated_backups = true
backup_retention_period = var.db_backup_retention
deletion_protection = false
engine = "aurora-postgresql"
engine_version = var.engine_version

kms_key_id = var.kms_key_id
master_password = random_string.postgresql_password.result
# no special characters allowed
master_username = var.db_username
Expand Down
23 changes: 0 additions & 23 deletions modules/aurora_database_cluster/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,6 @@ output "username" {
description = "The name of the main PostgreSQL user."
}

# The 'writer' endpoint for the cluster
output "cluster_endpoint" {
value = join("", aws_rds_cluster.aurora_postgresql.*.endpoint)
}

# List of all DB instance endpoints running in cluster
# output "all_instance_endpoints_list" {
# value = [concat(
# aws_rds_cluster_instance.cluster_instance_0.*.endpoint,
# aws_rds_cluster_instance.cluster_instance_n.*.endpoint,
# )]
# }

# A read-only endpoint for the Aurora cluster, automatically load-balanced across replicas
output "reader_endpoint" {
value = join("", aws_rds_cluster.aurora_postgresql.*.reader_endpoint)
}

# The ID of the RDS Cluster
output "cluster_identifier" {
value = join("", aws_rds_cluster.aurora_postgresql.*.id)
}

output "parameters" {
value = var.db_parameters
description = "PostgreSQL server parameters for the connection URI."
Expand Down
9 changes: 2 additions & 7 deletions modules/aurora_database_cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ variable "db_size" {
variable "db_backup_retention" {
type = number
description = "The days to retain backups for. Must be between 0 and 35"
default = 0
default = 1
}

variable "db_backup_window" {
Expand Down Expand Up @@ -70,7 +70,7 @@ variable "friendly_name_prefix" {
variable "network_private_subnet_cidrs" {
type = list(string)
description = "(Optional) List of private subnet CIDR ranges to create in VPC."
default = ["10.0.32.0/20", "10.0.48.0/20"]
default = ["10.0.32.0/20", "10.0.48.0/20", "10.0.112.0/20"]
}

variable "kms_key_id" {
Expand All @@ -79,11 +79,6 @@ variable "kms_key_id" {
default = null
}

variable "preferred_backup_window" {
description = "The daily time range during which automated backups are created if automated backups are enabled using the `backup_retention_period` parameter. Time in UTC"
type = string
default = "02:00-03:00"
}

variable "preferred_maintenance_window" {
description = "The weekly time range during which system maintenance can occur, in (UTC)"
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ variable "db_backup_retention" {
default = 0
}

variable "aurora_db_backup_retention" {
type = number
description = "The days to retain backups for. Must be between 0 and 35"
default = 1
}


variable "db_backup_window" {
type = string
description = "The daily time range (in UTC) during which automated backups are created if they are enabled"
Expand Down

0 comments on commit 468cc39

Please sign in to comment.