Skip to content
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

Settings resource #14

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved ss_client_cache, sso_cache options into the sso section
disc committed Nov 14, 2021
commit b7a681caf0e8623d6b352b08df1a19dcd6d610a4
36 changes: 26 additions & 10 deletions internal/provider/resource_settings_override.go
Original file line number Diff line number Diff line change
@@ -112,16 +112,6 @@ func resourceSettingsOverride() *schema.Resource {
Schema: ssoSettingsSchema,
},
},
"sso_cache": {
Type: schema.TypeBool,
Optional: true,
Description: "Enable an 8 hour secondary authentication cache using client ID, IP address and MAC address. This will allow clients to reconnect without secondary authentication. Works with Duo push, Okta push, OneLogin push, Duo passcodes and YubiKeys. Supported by all OpenVPN clients",
},
"sso_client_cache": {
Type: schema.TypeBool,
Optional: true,
Description: "Enable a two day secondary authentication cache using a token stored on the client. This will allow clients to reconnect without secondary authentication. Works with Duo push, Okta push, OneLogin push, Duo passcodes and YubiKeys. Only supported by Pritunl client",
},
"restrict_import": {
Type: schema.TypeBool,
Optional: true,
@@ -496,6 +486,14 @@ func resourceCreateSettingsOverride(ctx context.Context, d *schema.ResourceData,
settings.SSOOrg = v.(string)
}

if v, ok := d.GetOk("sso_settings.0.cache"); ok {
settings.SSOCache = v.(bool)
}

if v, ok := d.GetOk("sso_settings.0.client_cache"); ok {
settings.SSOClientCache = v.(bool)
}

if v, ok := d.GetOk("sso_settings.0.saml.0.url"); ok {
settings.SSOSamlUrl = v.(string)
}
@@ -855,6 +853,14 @@ func resourceUpdateSettingsOverride(ctx context.Context, d *schema.ResourceData,
settings.SSOOrg = d.Get("sso_settings.0.default_organization_id").(string)
}

if d.HasChange("sso_settings.0.cache") {
settings.SSOCache = d.Get("sso_settings.0.cache").(bool)
}

if d.HasChange("sso_settings.0.client_cache") {
settings.SSOClientCache = d.Get("sso_settings.0.client_cache").(bool)
}

if d.HasChange("sso_settings.0.saml.0.url") {
settings.SSOSamlUrl = d.Get("sso_settings.0.saml.0.url").(string)
}
@@ -1368,6 +1374,16 @@ var ssoSettingsSchema = map[string]*schema.Schema{
Required: true,
Description: "Default Single Sign-On Organization",
},
"cache": {
Type: schema.TypeBool,
Optional: true,
Description: "Enable an 8 hour secondary authentication cache using client ID, IP address and MAC address. This will allow clients to reconnect without secondary authentication. Works with Duo push, Okta push, OneLogin push, Duo passcodes and YubiKeys. Supported by all OpenVPN clients",
},
"client_cache": {
Type: schema.TypeBool,
Optional: true,
Description: "Enable a two day secondary authentication cache using a token stored on the client. This will allow clients to reconnect without secondary authentication. Works with Duo push, Okta push, OneLogin push, Duo passcodes and YubiKeys. Only supported by Pritunl client",
},
"okta": {
Type: schema.TypeList,
Optional: true,