Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Change String, Int, Map, Slice, List and Set to use GetOk instead of GetOkExists #241

Merged
merged 4 commits into from
Jun 4, 2020

Conversation

alexkappa
Copy link
Owner

@alexkappa alexkappa commented Jun 3, 2020

Proposed Changes

This PR changes something fairly fundamental to how this provider works. So far, testing whether a field has been defined in the terraform config, would be done using GetOkExists. This has been marked as deprecated by HashiCorp, but seemingly it remains for use for Boolean types.

  • resource_data: Change utility functions String, Int, Map, Slice, List, Set and JSON to rely on d.GetOk(key) to check whether a key has been set. Note: the Bool function still relies on d.GetOkExists(key).
  • resource/auth0_connection: option conditions expand unconditionally instead of if IsNewResource() or HasChange().

Fixes #237
Fixes #186
Fixes #239

Acceptance Test Output

$ make testacc
==> Checking that code complies with gofmt requirements...
?       github.com/terraform-providers/terraform-provider-auth0 [no test files]
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_debugDefaults
--- PASS: TestProvider_debugDefaults (0.00s)
=== RUN   TestAccClientGrant
--- PASS: TestAccClientGrant (3.09s)
=== RUN   TestAccClient
--- PASS: TestAccClient (1.14s)
=== RUN   TestAccClientZeroValueCheck
--- PASS: TestAccClientZeroValueCheck (2.20s)
=== RUN   TestAccClientRotateSecret
--- PASS: TestAccClientRotateSecret (2.94s)
=== RUN   TestAccClientInitiateLoginUri
--- PASS: TestAccClientInitiateLoginUri (0.07s)
=== RUN   TestAccClientJwtScopes
--- PASS: TestAccClientJwtScopes (1.99s)
=== RUN   TestAccConnection
--- PASS: TestAccConnection (1.63s)
=== RUN   TestAccConnectionAD
--- PASS: TestAccConnectionAD (0.89s)
=== RUN   TestAccConnectionAzureAD
--- PASS: TestAccConnectionAzureAD (1.29s)
=== RUN   TestAccConnectionOIDC
--- PASS: TestAccConnectionOIDC (1.67s)
=== RUN   TestAccConnectionWithEnbledClients
--- PASS: TestAccConnectionWithEnbledClients (1.65s)
=== RUN   TestAccConnectionSMS
--- PASS: TestAccConnectionSMS (0.85s)
=== RUN   TestAccConnectionEmail
--- PASS: TestAccConnectionEmail (1.59s)
=== RUN   TestAccConnectionSalesforce
--- PASS: TestAccConnectionSalesforce (0.83s)
=== RUN   TestAccConnectionGoogleOAuth2
--- PASS: TestAccConnectionGoogleOAuth2 (0.89s)
=== RUN   TestAccConnectionFacebook
--- PASS: TestAccConnectionFacebook (1.57s)
=== RUN   TestAccConnectionApple
--- PASS: TestAccConnectionApple (1.59s)
=== RUN   TestAccConnectionLinkedin
--- PASS: TestAccConnectionLinkedin (1.64s)
=== RUN   TestAccConnectionGitHub
--- PASS: TestAccConnectionGitHub (0.91s)
=== RUN   TestAccConnectionConfiguration
--- PASS: TestAccConnectionConfiguration (1.62s)
=== RUN   TestConnectionInstanceStateUpgradeV0
=== RUN   TestConnectionInstanceStateUpgradeV0/Empty
=== RUN   TestConnectionInstanceStateUpgradeV0/Zero
=== RUN   TestConnectionInstanceStateUpgradeV0/NonZero
=== RUN   TestConnectionInstanceStateUpgradeV0/Invalid
--- PASS: TestConnectionInstanceStateUpgradeV0 (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/Empty (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/Zero (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/NonZero (0.00s)
    --- PASS: TestConnectionInstanceStateUpgradeV0/Invalid (0.00s)
=== RUN   TestAccCustomDomain
--- PASS: TestAccCustomDomain (0.87s)
=== RUN   TestAccEmailTemplate
--- PASS: TestAccEmailTemplate (0.90s)
=== RUN   TestAccEmail
--- PASS: TestAccEmail (1.95s)
=== RUN   TestAccGlobalClient
--- PASS: TestAccGlobalClient (2.21s)
=== RUN   TestAccHook
--- PASS: TestAccHook (1.65s)
=== RUN   TestHookNameRegexp
--- PASS: TestHookNameRegexp (0.00s)
=== RUN   TestAccPrompt
--- PASS: TestAccPrompt (1.15s)
=== RUN   TestAccResourceServer
--- PASS: TestAccResourceServer (1.37s)
=== RUN   TestAccRole
--- PASS: TestAccRole (1.96s)
=== RUN   TestAccRolePermissions
--- PASS: TestAccRolePermissions (2.99s)
=== RUN   TestAccRuleConfig
--- PASS: TestAccRuleConfig (0.72s)
=== RUN   TestAccRule
--- PASS: TestAccRule (0.76s)
=== RUN   TestRuleNameRegexp
--- PASS: TestRuleNameRegexp (0.00s)
=== RUN   TestAccTenant
--- PASS: TestAccTenant (1.43s)
=== RUN   TestAccUserMissingRequiredParams
--- PASS: TestAccUserMissingRequiredParams (0.04s)
=== RUN   TestAccUser
--- PASS: TestAccUser (2.94s)
=== RUN   TestAccUserIssue218
--- PASS: TestAccUserIssue218 (1.48s)
=== RUN   TestMapData
=== RUN   TestMapData/GetOk
=== RUN   TestMapData/GetOkExists
--- PASS: TestMapData (0.00s)
    --- PASS: TestMapData/GetOk (0.00s)
    --- PASS: TestMapData/GetOkExists (0.00s)
=== RUN   TestJSON
--- PASS: TestJSON (0.00s)
PASS
coverage: 78.1% of statements
ok      github.com/terraform-providers/terraform-provider-auth0/auth0   52.543s coverage: 78.1% of statements
?       github.com/terraform-providers/terraform-provider-auth0/auth0/internal/debug    [no test files]
=== RUN   TestString
--- PASS: TestString (0.00s)
=== RUN   TestTemplate
--- PASS: TestTemplate (0.00s)
PASS
coverage: 75.0% of statements
ok      github.com/terraform-providers/terraform-provider-auth0/auth0/internal/random   0.219s  coverage: 75.0% of statements
=== RUN   TestIsURLWithNoFragment
--- PASS: TestIsURLWithNoFragment (0.00s)
PASS
coverage: 52.9% of statements
ok      github.com/terraform-providers/terraform-provider-auth0/auth0/internal/validation      0.017s  coverage: 52.9% of statements
?       github.com/terraform-providers/terraform-provider-auth0/version [no test files]

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

@alexkappa alexkappa marked this pull request as draft June 3, 2020 20:57
@alexkappa alexkappa marked this pull request as ready for review June 4, 2020 12:39
@alexkappa alexkappa merged commit 7669ce3 into master Jun 4, 2020
@yvovandoorn yvovandoorn deleted the fix-get-ok-exist branch March 24, 2021 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.