Skip to content

Commit

Permalink
Set default values for factors in case fields are empty (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanprodan-okta authored Sep 13, 2021
1 parent 0595f97 commit b3e198f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions examples/okta_app_saml/import.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ resource "okta_app_saml" "test" {
label = "testAcc_replace_with_uuid"

app_settings_json = <<JSON
{
"subdomain": "articulate"
}
{
"subdomain": "articulate",
"baseUrl": "https://example.com"
}
JSON
}
5 changes: 4 additions & 1 deletion okta/resource_okta_policy_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ func buildMFAPolicy(d *schema.ResourceData) sdk.Policy {

func syncFactor(d *schema.ResourceData, k string, f *sdk.PolicyFactor) {
if f == nil {
_ = d.Set(k, nil)
_ = d.Set(k, map[string]interface{}{
"consent_type": "NONE",
"enroll": "NOT_ALLOWED",
})
return
}
_ = d.Set(k, map[string]interface{}{
Expand Down
2 changes: 1 addition & 1 deletion sdk/policy_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (m *APISupplement) CreatePolicyRule(ctx context.Context, policyID string, b
return nil, nil, err
}
var policyRule *PolicyRule
resp, err := m.RequestExecutor.Do(ctx, req, policyRule)
resp, err := m.RequestExecutor.Do(ctx, req, &policyRule)
if err != nil {
return nil, resp, err
}
Expand Down

0 comments on commit b3e198f

Please sign in to comment.