github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/website/source/docs/providers/postgresql/index.html.markdown (about) 1 --- 2 layout: "postgresql" 3 page_title: "Provider: PostgreSQL" 4 sidebar_current: "docs-postgresql-index" 5 description: |- 6 A provider for PostgreSQL Server. 7 --- 8 9 # PostgreSQL Provider 10 11 The PostgreSQL provider gives the ability to deploy and configure resources in a PostgreSQL server. 12 13 Use the navigation to the left to read about the available resources. 14 15 ## Usage 16 17 ``` 18 provider "postgresql" { 19 host = "postgres_server_ip" 20 port = 5432 21 username = "postgres_user" 22 password = "postgres_password" 23 ssl_mode = "require" 24 } 25 26 ``` 27 28 Configuring multiple servers can be done by specifying the alias option. 29 30 ``` 31 provider "postgresql" { 32 alias = "pg1" 33 host = "postgres_server_ip1" 34 username = "postgres_user1" 35 password = "postgres_password1" 36 } 37 38 provider "postgresql" { 39 alias = "pg2" 40 host = "postgres_server_ip2" 41 username = "postgres_user2" 42 password = "postgres_password2" 43 } 44 45 resource "postgresql_database" "my_db1" { 46 provider = "postgresql.pg1" 47 name = "my_db1" 48 } 49 resource "postgresql_database" "my_db2" { 50 provider = "postgresql.pg2" 51 name = "my_db2" 52 } 53 54 55 ``` 56 57 ## Argument Reference 58 59 The following arguments are supported: 60 61 * `host` - (Required) The address for the postgresql server connection. 62 * `port` - (Optional) The port for the postgresql server connection. The default is `5432`. 63 * `username` - (Required) Username for the server connection. 64 * `password` - (Optional) Password for the server connection. 65 * `ssl_mode` - (Optional) Set the priority for an SSL connection to the server. 66 The default is `prefer`; the full set of options and their implications 67 can be seen [in the libpq SSL guide](http://www.postgresql.org/docs/9.4/static/libpq-ssl.html#LIBPQ-SSL-PROTECTION).