github.com/aspring/terraform@v0.8.2-0.20161216122603-6a8619a5db2e/website/source/docs/providers/postgresql/r/postgresql_role.html.markdown (about)

     1  ---
     2  layout: "postgresql"
     3  page_title: "PostgreSQL: postgresql_role"
     4  sidebar_current: "docs-postgresql-resource-postgresql_role"
     5  description: |-
     6    Creates and manages a role on a PostgreSQL server.
     7  ---
     8  
     9  # postgresql\_role
    10  
    11  The ``postgresql_role`` resource creates and manages a role on a PostgreSQL
    12  server.
    13  
    14  
    15  ## Usage
    16  
    17  ```
    18  resource "postgresql_role" "my_role" {
    19    name = "my_role"
    20    login = true
    21    password = "mypass"
    22  }
    23  
    24  resource "postgresql_role" "my_replication_role" {
    25    name = "replication_role"
    26    replication = true
    27    login = true
    28    connection_limit = 5
    29    password = "md5c98cbfeb6a347a47eb8e96cfb4c4b890"
    30  }
    31  ```
    32  
    33  ## Argument Reference
    34  
    35  * `name` - (Required) The name of the role. Must be unique on the PostgreSQL
    36    server instance where it is configured.
    37  
    38  * `superuser` - (Optional) Defines whether the role is a "superuser", and
    39    therefore can override all access restrictions within the database.  Default
    40    value is `false`.
    41  
    42  * `create_database` - (Optional) Defines a role's ability to execute `CREATE
    43    DATABASE`.  Default value is `false`.
    44  
    45  * `create_role` - (Optional) Defines a role's ability to execute `CREATE ROLE`.
    46    A role with this privilege can also alter and drop other roles.  Default value
    47    is `false`.
    48  
    49  * `inherit` - (Optional) Defines whether a role "inherits" the privileges of
    50    roles it is a member of.  Default value is `true`.
    51  
    52  * `login` - (Optional) Defines whether role is allowed to log in.  Roles without
    53    this attribute are useful for managing database privileges, but are not users
    54    in the usual sense of the word.  Default value is `false`.
    55  
    56  * `replication` - (Optional) Defines whether a role is allowed to initiate
    57    streaming replication or put the system in and out of backup mode.  Default
    58    value is `false`
    59  
    60  * `bypass_row_level_security` - (Optional) Defines whether a role bypasses every
    61    row-level security (RLS) policy.  Default value is `false`.
    62  
    63  * `connection_limit` - (Optional) If this role can log in, this specifies how
    64    many concurrent connections the role can establish. `-1` (the default) means no
    65    limit.
    66  
    67  * `encrypted_password` - (Optional) Defines whether the password is stored
    68    encrypted in the system catalogs.  Default value is `true`.  NOTE: this value
    69    is always set (to the conservative and safe value), but may interfere with the
    70    behavior of
    71    [PostgreSQL's `password_encryption` setting](https://www.postgresql.org/docs/current/static/runtime-config-connection.html#GUC-PASSWORD-ENCRYPTION).
    72  
    73  * `password` - (Optional) Sets the role's password. (A password is only of use
    74    for roles having the `login` attribute set to true, but you can nonetheless
    75    define one for roles without it.) Roles without a password explicitly set are
    76    left alone.  If the password is set to the magic value `NULL`, the password
    77    will be always be cleared.
    78  
    79  * `valid_until` - (Optional) Defines the date and time after which the role's
    80    password is no longer valid.  Established connections past this `valid_time`
    81    will have to be manually terminated.  This value corresponds to a PostgreSQL
    82    datetime. If omitted or the magic value `NULL` is used, `valid_until` will be
    83    set to `infinity`.  Default is `NULL`, therefore `infinity`.
    84  
    85  ## Import Example
    86  
    87  `postgresql_role` supports importing resources.  Supposing the following
    88  Terraform:
    89  
    90  ```
    91  provider "postgresql" {
    92    alias = "admindb"
    93  }
    94  
    95  resource "postgresql_role" "replication_role" {
    96    provider = "postgresql.admindb"
    97  
    98    name = "replication_name"
    99  }
   100  ```
   101  
   102  It is possible to import a `postgresql_role` resource with the following
   103  command:
   104  
   105  ```
   106  $ terraform import postgresql_role.replication_role replication_name
   107  ```
   108  
   109  Where `replication_name` is the name of the role to import and
   110  `postgresql_role.replication_role` is the name of the resource whose state will
   111  be populated as a result of the command.