Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Use pointers for values that can be zero #331

Merged
merged 1 commit into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions examples/okta_app_basic_auth/basic_updated.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ resource "okta_group" "group" {
}

resource "okta_app_basic_auth" "test" {
label = "testAcc_replace_with_uuid"
url = "https://example.com/login.html"
label = "testAcc_replace_with_uuid"
url = "https://example.com/login.html"
auth_url = "https://example.com/auth.html"

users {
Expand Down
2 changes: 1 addition & 1 deletion examples/okta_policy_password/basic_updated.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource okta_policy_password test {
password_expire_warn_days = 15
password_min_age_minutes = 60
password_history_count = 5
password_max_lockout_attempts = 3
password_max_lockout_attempts = 0
password_auto_unlock_minutes = 2
password_show_lockout_failures = true
question_min_length = 10
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/articulate/terraform-provider-okta
go 1.12

require (
github.com/articulate/oktasdk-go v0.0.0-20190417182045-e41ed7befc56
github.com/articulate/oktasdk-go v1.0.1
github.com/aws/aws-sdk-go v1.23.16 // indirect
github.com/beevik/etree v1.1.0 // indirect
github.com/bflad/tfproviderlint v0.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/articulate/okta-sdk-golang v1.1.1 h1:ymEGt5P/Ckqygz7TtyUINRp7oP7fAhS0nAqoAZ4eM3o=
github.com/articulate/okta-sdk-golang v1.1.1/go.mod h1:6ymIhzFQtMyBnwqkEHc/reQUMalObOjgyOSbf3w21PM=
github.com/articulate/oktasdk-go v0.0.0-20190417182045-e41ed7befc56 h1:3oNDqjcsOep3W9pV9SQegVkViLCBGMu8ECIliq3B9dU=
github.com/articulate/oktasdk-go v0.0.0-20190417182045-e41ed7befc56/go.mod h1:UTdWnHE/nQNjDvbmLBwxIHjJ3L8r3XlZZaqVDIUtu1I=
github.com/articulate/oktasdk-go v1.0.1 h1:UuvJSY5yUqT0w9+hdACq1bcmIKAqh25bnVHWWQtsvYQ=
github.com/articulate/oktasdk-go v1.0.1/go.mod h1:UTdWnHE/nQNjDvbmLBwxIHjJ3L8r3XlZZaqVDIUtu1I=
github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM=
github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
Expand Down
13 changes: 13 additions & 0 deletions okta/resource_okta_app_oauth_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package okta

import (
"errors"
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/okta/okta-sdk-golang/okta"
"github.com/okta/okta-sdk-golang/okta/query"
)
Expand Down Expand Up @@ -57,6 +59,17 @@ func TestAccAppOauth_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceName, "client_id"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateCheck: func(s []*terraform.InstanceState) error {
if len(s) != 1 {
return errors.New("Failed to import schema into state")
}

return nil
},
},
},
})
}
Expand Down
24 changes: 12 additions & 12 deletions okta/resource_okta_policy_password.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,23 +313,23 @@ func buildPasswordPolicy(d *schema.ResourceData, m interface{}) *articulateOkta.
}

template.Conditions.AuthProvider.Provider = d.Get("auth_provider").(string)
template.Settings.Password.Complexity.MinLength = d.Get("password_min_length").(int)
template.Settings.Password.Complexity.MinLowerCase = d.Get("password_min_lowercase").(int)
template.Settings.Password.Complexity.MinUpperCase = d.Get("password_min_uppercase").(int)
template.Settings.Password.Complexity.MinNumber = d.Get("password_min_number").(int)
template.Settings.Password.Complexity.MinSymbol = d.Get("password_min_symbol").(int)
template.Settings.Password.Complexity.MinLength = intPtr(d.Get("password_min_length").(int))
template.Settings.Password.Complexity.MinLowerCase = intPtr(d.Get("password_min_lowercase").(int))
template.Settings.Password.Complexity.MinUpperCase = intPtr(d.Get("password_min_uppercase").(int))
template.Settings.Password.Complexity.MinNumber = intPtr(d.Get("password_min_number").(int))
template.Settings.Password.Complexity.MinSymbol = intPtr(d.Get("password_min_symbol").(int))
template.Settings.Password.Complexity.ExcludeUsername = d.Get("password_exclude_username").(bool)
template.Settings.Password.Complexity.ExcludeAttributes = getExcludedAttrs(d.Get("password_exclude_first_name").(bool), d.Get("password_exclude_last_name").(bool))
template.Settings.Password.Complexity.Dictionary.Common.Exclude = d.Get("password_dictionary_lookup").(bool)
template.Settings.Password.Age.MaxAgeDays = d.Get("password_max_age_days").(int)
template.Settings.Password.Age.ExpireWarnDays = d.Get("password_expire_warn_days").(int)
template.Settings.Password.Age.MinAgeMinutes = d.Get("password_min_age_minutes").(int)
template.Settings.Password.Age.HistoryCount = d.Get("password_history_count").(int)
template.Settings.Password.Lockout.MaxAttempts = d.Get("password_max_lockout_attempts").(int)
template.Settings.Password.Lockout.AutoUnlockMinutes = d.Get("password_auto_unlock_minutes").(int)
template.Settings.Password.Age.MaxAgeDays = intPtr(d.Get("password_max_age_days").(int))
template.Settings.Password.Age.ExpireWarnDays = intPtr(d.Get("password_expire_warn_days").(int))
template.Settings.Password.Age.MinAgeMinutes = intPtr(d.Get("password_min_age_minutes").(int))
template.Settings.Password.Age.HistoryCount = intPtr(d.Get("password_history_count").(int))
template.Settings.Password.Lockout.MaxAttempts = intPtr(d.Get("password_max_lockout_attempts").(int))
template.Settings.Password.Lockout.AutoUnlockMinutes = intPtr(d.Get("password_auto_unlock_minutes").(int))
template.Settings.Password.Lockout.ShowLockoutFailures = d.Get("password_show_lockout_failures").(bool)
template.Settings.Recovery.Factors.RecoveryQuestion.Status = d.Get("question_recovery").(string)
template.Settings.Recovery.Factors.RecoveryQuestion.Properties.Complexity.MinLength = d.Get("question_min_length").(int)
template.Settings.Recovery.Factors.RecoveryQuestion.Properties.Complexity.MinLength = intPtr(d.Get("question_min_length").(int))
template.Settings.Recovery.Factors.OktaEmail.Properties.RecoveryToken.TokenLifetimeMinutes = d.Get("recovery_email_token").(int)
template.Settings.Recovery.Factors.OktaSms.Status = d.Get("sms_recovery").(string)
template.Settings.Recovery.Factors.OktaEmail.Status = d.Get("email_recovery").(string)
Expand Down
2 changes: 1 addition & 1 deletion okta/resource_okta_policy_password_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestAccOktaPolicyPassword_crud(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "password_expire_warn_days", "15"),
resource.TestCheckResourceAttr(resourceName, "password_min_age_minutes", "60"),
resource.TestCheckResourceAttr(resourceName, "password_history_count", "5"),
resource.TestCheckResourceAttr(resourceName, "password_max_lockout_attempts", "3"),
resource.TestCheckResourceAttr(resourceName, "password_max_lockout_attempts", "0"),
resource.TestCheckResourceAttr(resourceName, "password_auto_unlock_minutes", "2"),
resource.TestCheckResourceAttr(resourceName, "password_show_lockout_failures", "true"),
resource.TestCheckResourceAttr(resourceName, "question_min_length", "10"),
Expand Down
24 changes: 12 additions & 12 deletions vendor/github.com/articulate/oktasdk-go/okta/policies.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/articulate/oktasdk-go/okta/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ github.com/apparentlymart/go-cidr/cidr
github.com/apparentlymart/go-textseg/textseg
# github.com/armon/go-radix v1.0.0
github.com/armon/go-radix
# github.com/articulate/oktasdk-go v0.0.0-20190417182045-e41ed7befc56
# github.com/articulate/oktasdk-go v1.0.1
github.com/articulate/oktasdk-go/okta
# github.com/aws/aws-sdk-go v1.23.16
github.com/aws/aws-sdk-go/aws
Expand Down