Skip to content

Commit

Permalink
Merge pull request #3 from Mongey/cm-recoverykeys
Browse files Browse the repository at this point in the history
Add recovery_keys, recovery_keys_base64 to vaultoperator_init resource
  • Loading branch information
rickardgranberg authored Jan 18, 2022
2 parents ca6a8e0 + f1533e3 commit fb469f0
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions internal/provider/resource_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ import (
)

const (
argSecretShares = "secret_shares"
argSecretThreshold = "secret_threshold"
argStoredShares = "stored_shares"
argRecoveryShares = "recovery_shares"
argRecoveryThreshold = "recovery_threshold"
argRootToken = "root_token"
argKeys = "keys"
argKeysBase64 = "keys_base64"
argSecretShares = "secret_shares"
argSecretThreshold = "secret_threshold"
argStoredShares = "stored_shares"
argRecoveryShares = "recovery_shares"
argRecoveryThreshold = "recovery_threshold"
argRecoveryKeys = "recovery_keys"
argRecoveryKeysBase64 = "recovery_keys_base64"
argRootToken = "root_token"
argKeys = "keys"
argKeysBase64 = "keys_base64"
)

func resourceInit() *schema.Resource {
Expand Down Expand Up @@ -82,6 +84,24 @@ func resourceInit() *schema.Resource {
Type: schema.TypeString,
},
},
argRecoveryKeys: {
Description: "The recovery keys",
Type: schema.TypeSet,
Computed: true,
Sensitive: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
argRecoveryKeysBase64: {
Description: "The recovery keys, base64 encoded.",
Type: schema.TypeSet,
Computed: true,
Sensitive: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
}
}
Expand Down Expand Up @@ -198,6 +218,12 @@ func updateState(d *schema.ResourceData, id string, res *api.InitResponse) error
if err := d.Set(argKeysBase64, res.KeysB64); err != nil {
return err
}
if err := d.Set(argRecoveryKeys, res.RecoveryKeys); err != nil {
return err
}
if err := d.Set(argRecoveryKeysBase64, res.RecoveryKeysB64); err != nil {
return err
}

return nil
}

0 comments on commit fb469f0

Please sign in to comment.