github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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  ```hcl
    18  provider "postgresql" {
    19    host            = "postgres_server_ip"
    20    port            = 5432
    21    database        = "postgres"
    22    username        = "postgres_user"
    23    password        = "postgres_password"
    24    sslmode         = "require"
    25    connect_timeout = 15
    26  }
    27  ```
    28  
    29  Configuring multiple servers can be done by specifying the alias option.
    30  
    31  ```hcl
    32  provider "postgresql" {
    33    alias    = "pg1"
    34    host     = "postgres_server_ip1"
    35    username = "postgres_user1"
    36    password = "postgres_password1"
    37  }
    38  
    39  provider "postgresql" {
    40    alias    = "pg2"
    41    host     = "postgres_server_ip2"
    42    username = "postgres_user2"
    43    password = "postgres_password2"
    44  }
    45  
    46  resource "postgresql_database" "my_db1" {
    47    provider = "postgresql.pg1"
    48    name     = "my_db1"
    49  }
    50  
    51  resource "postgresql_database" "my_db2" {
    52    provider = "postgresql.pg2"
    53    name     = "my_db2"
    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  * `database` - (Optional) Database to connect to. The default is `postgres`.
    64  * `username` - (Required) Username for the server connection.
    65  * `password` - (Optional) Password for the server connection.
    66  * `sslmode` - (Optional) Set the priority for an SSL connection to the server.
    67    Valid values for `sslmode` are (note: `prefer` is not supported by Go's
    68    [`lib/pq`](https://godoc.org/github.com/lib/pq)):
    69      * disable - No SSL
    70      * require - Always SSL (the default, also skip verification)
    71      * verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
    72      * verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
    73    Additional information on the options and their implications can be seen
    74    [in the `libpq(3)` SSL guide](http://www.postgresql.org/docs/current/static/libpq-ssl.html#LIBPQ-SSL-PROTECTION).
    75  * `connect_timeout` - (Optional) Maximum wait for connection, in seconds. The
    76    default is `180s`.  Zero or not specified means wait indefinitely.