Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Commit

Permalink
postgresql_role: Add roles attribute.
Browse files Browse the repository at this point in the history
* This allows to grant roles to the role we are managing.
  • Loading branch information
cyrilgdn committed Mar 4, 2019
1 parent 8d51d74 commit b022254
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 69 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
## 0.2.2 (Unreleased)
## 0.3.0 (Unreleased)

FEATURES:

* `postgresql_role`: Add `roles` attribute.

## 0.2.1 (February 28, 2019)

BUG FIXES:

* `provider`: Add a `superuser` setting to fix role password update when provider is not connected as a superuser.
([#66](https://github.com/terraform-providers/terraform-provider-postgresql/pull/66))

## 0.2.0 (February 21, 2019)

FEATURES:

* Add `database_username` in provider configuration to manage [user name maps](https://www.postgresql.org/docs/current/auth-username-maps.html) (e.g.: needed for Azure)
Expand Down
10 changes: 10 additions & 0 deletions postgresql/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"database/sql"

"github.com/hashicorp/errwrap"

"github.com/hashicorp/terraform/helper/schema"
"github.com/lib/pq"
)

Expand Down Expand Up @@ -91,3 +93,11 @@ func revokeRoleMembership(db *sql.DB, role, member string) error {
}
return nil
}

func pgArrayToSet(arr pq.ByteaArray) *schema.Set {
s := make([]interface{}, len(arr))
for i, v := range arr {
s[i] = string(v)
}
return schema.NewSet(schema.HashString, s)
}
Loading

0 comments on commit b022254

Please sign in to comment.