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

Diffs are determined incorrectly on many list results #304

Open
daethnir opened this issue Dec 8, 2024 · 0 comments
Open

Diffs are determined incorrectly on many list results #304

daethnir opened this issue Dec 8, 2024 · 0 comments

Comments

@daethnir
Copy link

daethnir commented Dec 8, 2024

The fusionauth api seems to return lists in a consistent order about 80% of the time. For example an API key gets permissions on endpoints in a list. What order they are is irrelevant to fusionauth, but this provider demands they be in the same order or it considers it needing update.

Pulumi example output below may make it more clear. If you look at the first element /api/email/send came first from fusinonauth API, and now /api/application comes first. However if you dig in you'll see that /api/email/send is now seen in # 2, and has the same perms (true/true/true) as before.

Since ordering is not important for some of these APIs the terraform should be more logical in comparing them. In this case doing a sort on endpoint of the old / new results would do the trick and eliminate false positives.

This bug throws off any sanity checking or the ability to run in cicd in check mode because we'll get false positives all the time.

      ~ permissionsEndpoints: [                                      
          ~ [0]: {
                  + __defaults: [
                  +     [0]: "delete"
                  +     [1]: "patch"                                     
                  +     [2]: "post"                                                                                                                                                                                                                                                                    
                  +     [3]: "put"           
                    ]                        
                  ~ delete    : true => false                            
                  ~ endpoint  : "/api/email/send" => "/api/application"
                  ~ patch     : true => false
                  ~ post      : true => false                            
                  ~ put       : true => false   
                }                                                 
          ~ [1]: {                           
                  + __defaults: [        
                  +     [0]: "delete"
                  +     [1]: "patch"                                                                                                               
                  +     [2]: "post"                                                                                                                
                  +     [3]: "put"                                       
                    ]                                                                                                                                                                                                                                                                                  
                  ~ endpoint  : "/api/user/recent-login" => "/api/application/role"                                                                
                }                                                        
          ~ [2]: {                            
                  + __defaults: []                                                                                                                 
                  ~ endpoint  : "/api/user/registration" => "/api/email/send"                                                                      
                }                   
          ~ [3]: {                                                                                                                                 
                  + __defaults: []                                                                                                                                                                                                                                                                     
                  ~ delete    : false => true                                                                                                      
                  ~ endpoint  : "/api/application/role" => "/api/user"   
                  ~ patch     : false => true
                  ~ post      : false => true
                  ~ put       : false => true
                }                                                        
         ~ [4]: {                                                                                                                                                                                                                                                                   
                  + __defaults: [
                  +     [0]: "delete"                                                                                                              
                  +     [1]: "patch"
                  +     [2]: "post"
                  +     [3]: "put"
                    ]
                  ~ delete    : true => false
                  ~ endpoint  : "/api/user" => "/api/user/recent-login"
                  ~ patch     : true => false
                  ~ post      : true => false
                  ~ put       : true => false
                }
          ~ [5]: {
                  + __defaults: []
                  ~ delete    : false => true
                  ~ endpoint  : "/api/application" => "/api/user/registration"
                  ~ patch     : false => true
                  ~ post      : false => true
                  ~ put       : false => true
                }
          ~ [6]: {
                  + __defaults: [
                  +     [0]: "delete"
                  +     [1]: "patch"
                  +     [2]: "post"
                  +     [3]: "put"
                    ]
                  ~ delete    : true => false
                  ~ endpoint  : "/api/user/change-password" => "/api/user/search"
                  ~ patch     : true => false
                  ~ post      : true => false
                  ~ put       : true => false
                }
          - [7]: {
                  - delete  : false
                  - endpoint: "/api/user/search"
                  - get     : true
                  - patch   : false
                  - post    : false
                  - put     : false
                }
        ]


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant