Skip to content

Commit a3f193d

Browse files
committed
[GH-102] Fix read approle_auth_role regression
1 parent e7c9ebb commit a3f193d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

vault/resource_approle_auth_backend_role.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,18 @@ func approleAuthBackendRoleRead(d *schema.ResourceData, meta interface{}) error
212212
}
213213

214214
var cidrs []string
215-
if resp.Data["bound_cidr_list"].(string) != "" {
216-
cidrs = strings.Split(resp.Data["bound_cidr_list"].(string), ",")
215+
216+
// NOTE: `string` is for backward-compatibility with pre-0.10.0 Vault.
217+
switch value := resp.Data["bound_cidr_list"].(type) {
218+
case string:
219+
if resp.Data["bound_cidr_list"].(string) != "" {
220+
cidrs = strings.Split(value, ",")
221+
}
222+
case []interface{}:
223+
iCIDRlist := resp.Data["bound_cidr_list"].([]interface{})
224+
for _, iCIDR := range iCIDRlist {
225+
cidrs = append(cidrs, iCIDR.(string))
226+
}
217227
}
218228

219229
secretIDTTL, err := resp.Data["secret_id_ttl"].(json.Number).Int64()

0 commit comments

Comments
 (0)