Advertisement
Guest User

Untitled

a guest
Sep 10th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. resource "aws_db_instance" "postgres" {
  2. identifier = "${var.postgres_id}"
  3. name = "${var.postgres_name}"
  4.  
  5. engine = "${var.postgres_engine}"
  6. engine_version = "${var.postgres_version}"
  7. multi_az = "${var.postgres_multi_az}"
  8. instance_class = "${var.postgres_class}"
  9. db_subnet_group_name = "${var.postgres_subnet_group}"
  10.  
  11. username = "${var.postgres_username}"
  12. password = "temporaryPasswordOverriddenBelowOnFirstApply"
  13. provisioner "local-exec" {
  14. command = "bash -c 'DBPASS=$$(openssl rand -base64 16) && echo $${DBPASS} >> ${self.id}.passwd && aws --region ${var.provider_settings["region"]} rds modify-db-instance --db-instance-identifier ${self.id} --master-user-password $${DBPASS} --apply-immediately'"
  15. }
  16.  
  17. storage_type = "${var.postgres_storage_type}"
  18. allocated_storage = "${var.postgres_storage_capacity}"
  19.  
  20. vpc_security_group_ids = ["${aws_security_group.postgres_security_group.id}"]
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement