main.tf 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. #-------------------
  2. # RDS Postgresql Database
  3. #-------------------
  4. resource "aws_db_instance" "postgresql" {
  5. identifier = "db-${var.stack_name}"
  6. allocated_storage = "${var.rds_allocated_storage}"
  7. engine = "postgres"
  8. engine_version = "${var.rds_engine_version}"
  9. instance_class = "${var.rds_instance_class}"
  10. name = "nuxeo"
  11. username = "${var.database_user}"
  12. password = "${var.database_password}"
  13. // Because we're assuming a VPC, we use this option, but only one SG id
  14. vpc_security_group_ids = ["${var.security_group_ids}"]
  15. // We're creating a subnet group in the module and passing in the name
  16. db_subnet_group_name = "${aws_db_subnet_group.postgresql.id}"
  17. parameter_group_name = "default.postgres9.4"
  18. multi_az = "${var.rds_is_multi_az}"
  19. storage_type = "${var.rds_storage_type}"
  20. tags {
  21. Name = "${var.stack_name} - Nuxeo Postgres Database"
  22. billing-category = "customers"
  23. billing-subcategory = "${var.stack_name}"
  24. role= "nuxeo.db"
  25. }
  26. }
  27. resource "aws_db_subnet_group" "postgresql" {
  28. name = "${var.stack_name}-db-subnet-group"
  29. description = "RDS private subnet group"
  30. subnet_ids = ["${var.subnet_ids}"]
  31. }