main.tf 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. module "jira_db" {
  2. source = "terraform-aws-modules/rds/aws"
  3. version = "~> v2.0"
  4. identifier = var.identifier # this is the RDS identifier, not the DB name
  5. name = "jira" # the DB name
  6. engine = "postgres"
  7. engine_version = "11.8"
  8. instance_class = var.instance_type
  9. allocated_storage = var.jira_rds_storage
  10. storage_encrypted = true
  11. kms_key_id = module.jira_key.key_arn
  12. ca_cert_identifier = "rds-ca-2019"
  13. # NOTE: Do NOT use 'user' as the value for 'username' as it throws:
  14. # "Error creating DB Instance: InvalidParameterValue: MasterUsername
  15. # user cannot be used as it is a reserved word used by the engine"
  16. username = "jira"
  17. password = "YourPwdShouldBeLongAndSecure!"
  18. port = "5432"
  19. vpc_security_group_ids = [ aws_security_group.jira_rds_sg.id ]
  20. # FTD: Should these be reversed? Backup _before_ maintenance?
  21. maintenance_window = "Mon:00:00-Mon:03:00"
  22. backup_window = "03:00-06:00"
  23. # disable backups to create DB faster
  24. backup_retention_period = 0
  25. tags = merge(var.standard_tags, var.tags)
  26. enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]
  27. # DB subnet group
  28. subnet_ids = var.subnets
  29. # DB parameter group
  30. family = "postgres11"
  31. # DB option group
  32. major_engine_version = "11"
  33. # Snapshot name upon DB deletion
  34. final_snapshot_identifier = "${var.identifier}-final-snapshot"
  35. # Database Deletion Protection
  36. deletion_protection = var.instance_termination_protection
  37. }