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

Creation of a group with a list of virtual folders provides error: Provider produced inconsistent result after apply #12

Open
bankinobi opened this issue Jul 14, 2024 · 3 comments

Comments

@bankinobi
Copy link

Hi!

When i'm trying to create group with multiple virtual folders inside i got an error:

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to sftpgo_group.group["MyGroup"], provider "provider[\"registry.terraform.io/drakkan/sftpgo\"]" produced an unexpected new value: .virtual_folders[0].virtual_path: was cty.StringVal("/MyGroup"), but now
│ cty.StringVal("/MyGroup-new").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to sftpgo_group.group["MyGroup"], provider "provider[\"registry.terraform.io/drakkan/sftpgo\"]" produced an unexpected new value: .virtual_folders[0].name: was cty.StringVal("MyGroup"), but now cty.StringVal("MyGroup-new").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to sftpgo_group.group["MyGroup"], provider "provider[\"registry.terraform.io/drakkan/sftpgo\"]" produced an unexpected new value: .virtual_folders[1].name: was cty.StringVal("MyGroup-new"), but now cty.StringVal("MyGroup").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to sftpgo_group.group["MyGroup"], provider "provider[\"registry.terraform.io/drakkan/sftpgo\"]" produced an unexpected new value: .virtual_folders[1].virtual_path: was cty.StringVal("/MyGroup-new"), but now
│ cty.StringVal("/MyGroup").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Provider version: 0.0.12

My resource:

resource "sftpgo_group" "group" {
  for_each        = { for group in local.groups : group.name => group }
  name            = each.value.name
  virtual_folders = each.value.virtual_folder
  depends_on      = [sftpgo_folder.folder]
}

Locals:

  groups = [for group in var.groups : {
    name = group.name
    virtual_folder = [for group_folder in group.virtual_folders : {
      name         = group_folder.name
      virtual_path = group_folder.virtual_path
      quota_files  = -1
      quota_size   = -1
    }]
  }]

State entry after apply

terraform state show 'sftpgo_group.group["MyGroup"]'                            
# sftpgo_group.group["MyGroup"]: (tainted)
resource "sftpgo_group" "group" {
    created_at      = 1720940997721
    id              = "MyGroup"
    name            = "MyGroup"
    updated_at      = 1720940997721
    user_settings   = {
        filesystem = {
            provider = 0
        }
        filters    = {}
    }
    virtual_folders = [
        {
            filesystem        = {
                osconfig = {
                    read_buffer_size  = 10
                    write_buffer_size = 10
                }
                provider = 0
            }
            last_quota_update = 0
            mapped_path       = "/srv/sftpgo/data/folder-1/MyGroup-new"
            name              = "MyGroup-new"
            quota_files       = -1
            quota_size        = -1
            used_quota_files  = 0
            used_quota_size   = 0
            virtual_path      = "/MyGroup-new"
        },
        {
            filesystem        = {
                osconfig = {
                    read_buffer_size  = 10
                    write_buffer_size = 10
                }
                provider = 0
            }
            last_quota_update = 0
            mapped_path       = "/srv/sftpgo/data/folder-2/MyGroup"
            name              = "MyGroup"
            quota_files       = -1
            quota_size        = -1
            used_quota_files  = 0
            used_quota_size   = 0
            virtual_path      = "/MyGroup"
        },
    ]
}
@bankinobi
Copy link
Author

bankinobi commented Jul 14, 2024

Got the same behaviour on previous 0.0.11 provider version
Works as expected when there is only one virtual folder in a group

@bankinobi
Copy link
Author

Also, if you'll try to change the order and types of groups for existing user state, it will produce the same error

Error: Provider produced inconsistent result after apply
...

@yroffin
Copy link

yroffin commented Aug 28, 2024

hi,

it could be a sort problem, i've an issue like this on groups with sftpgo_user
if update my groups to be alpha sorted ... and it seem to correct the problem

i assume during plan list is not sorted by name, and when apply output is sorted

i hope it can help :)

Error: Provider produced inconsistent result after apply

with list ["svc_accounts","ocean-rw"]

When applying changes to sftpgo_user.talend_service_account[0], provider
"provider[\"registry.terraform.io/drakkan/sftpgo\"]" produced an unexpected
new value: .groups[0].name: was cty.StringVal("svc_accounts"), but now
cty.StringVal("ocean-rw").

with list ["ocean-rw", "svc_accounts"] no apply problem

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

2 participants