-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support default_extensions_template in SSH #2361
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,11 @@ func sshSecretBackendRoleResource() *schema.Resource { | |
Type: schema.TypeMap, | ||
Optional: true, | ||
}, | ||
"default_extensions_template": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, | ||
}, | ||
"default_critical_options": { | ||
Type: schema.TypeMap, | ||
Optional: true, | ||
|
@@ -243,6 +248,12 @@ func sshSecretBackendRoleWrite(d *schema.ResourceData, meta interface{}) error { | |
data["default_extensions"] = v | ||
} | ||
|
||
if provider.IsAPISupported(meta, provider.VaultVersion180) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an unsupported Vault version. We need not add a check for it |
||
if v, ok := d.GetOk("default_extensions_template"); ok { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use d.Get() for booleans. If you test the update path I think you may find that d.GetOk() does not update the field. |
||
data["default_extensions_template"] = v.(bool) | ||
} | ||
} | ||
|
||
if v, ok := d.GetOk("default_critical_options"); ok { | ||
data["default_critical_options"] = v | ||
} | ||
|
@@ -364,6 +375,10 @@ func sshSecretBackendRoleRead(d *schema.ResourceData, meta interface{}) error { | |
"max_ttl", "ttl", "algorithm_signer", "not_before_duration", | ||
} | ||
|
||
if provider.IsAPISupported(meta, provider.VaultVersion180) { | ||
fields = append(fields, []string{"default_extensions_template"}...) | ||
} | ||
|
||
if provider.IsAPISupported(meta, provider.VaultVersion112) { | ||
fields = append(fields, []string{"default_user_template", "allowed_domains_template"}...) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are unsupported Vault versions. We need not add checks for them