Change the default for `valid_until` to `infinity` to match the default.
This commit is contained in:
parent
e9dc92c18d
commit
e36827c5fe
|
@ -65,10 +65,10 @@ func resourcePostgreSQLRole() *schema.Resource {
|
|||
Default: true,
|
||||
Description: "Control whether the password is stored encrypted in the system catalogs",
|
||||
},
|
||||
|
||||
roleValidUntilAttr: {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Default: "infinity",
|
||||
Description: "Sets a date and time after which the role's password is no longer valid",
|
||||
},
|
||||
roleConnLimitAttr: {
|
||||
|
@ -188,8 +188,8 @@ func resourcePostgreSQLRoleCreate(d *schema.ResourceData, meta interface{}) erro
|
|||
}
|
||||
case opt.hclKey == roleValidUntilAttr:
|
||||
switch {
|
||||
case v.(string) == "", strings.ToUpper(v.(string)) == "NULL":
|
||||
createOpts = append(createOpts, fmt.Sprintf("%s %s", opt.sqlKey, "'infinity'"))
|
||||
case v.(string) == "", strings.ToLower(v.(string)) == "infinity":
|
||||
createOpts = append(createOpts, fmt.Sprintf("%s '%s'", opt.sqlKey, "infinity"))
|
||||
default:
|
||||
createOpts = append(createOpts, fmt.Sprintf("%s %s", opt.sqlKey, pq.QuoteIdentifier(val)))
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func TestAccPostgresqlRole_Basic(t *testing.T) {
|
|||
resource.TestCheckResourceAttr(
|
||||
"postgresql_role.role_with_defaults", "password", ""),
|
||||
resource.TestCheckResourceAttr(
|
||||
"postgresql_role.role_with_defaults", "valid_until", "NULL"),
|
||||
"postgresql_role.role_with_defaults", "valid_until", "infinity"),
|
||||
),
|
||||
},
|
||||
},
|
||||
|
@ -165,6 +165,6 @@ resource "postgresql_role" "role_with_defaults" {
|
|||
connection_limit = -1
|
||||
encrypted_password = true
|
||||
password = ""
|
||||
valid_until = "NULL"
|
||||
valid_until = "infinity"
|
||||
}
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue