-
Notifications
You must be signed in to change notification settings - Fork 7
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
Idempotent virtual_folders declaration #4
Comments
Hello, thanks for this detailed report. Unfortunately I'm busy with lots of other things and don't have time to analyze it further in the immediate future. The same support policy as SFTPGo applies here. Feel free to investigate the issue further and send a PR (please be patient if I'm slow to respond). |
Hi @drakkan ! The thing is that I can mitigate the issue with this trick :
The API seems that it can't handle high parallelism (by default 10 calls in Terraform) when you declare a loop on a list of project in the ressource sftpgo_group. At this time it's mitigated but not "perfect", you have to apply "twice" terraform to have a working terraform apply. No problem for your "support policy", it's not a "request" more a experience return from a user that love your product and want to help you improve it ;) Have fun ! Best regards |
I have not tried to reproduce the problem myself, but if it is related to virtual folder sorting, try the provider with the development version of SFTPGo, the virtual folders are now sorted by name, so as long as you list the virtual folders sorted by name in the tf file, the order should be preserved |
Hi Drakkan, I do a quick test, and the result is the same with the latest sftpgo:edge Docker image at this time.
TF example sftpgo_group : The name is composed by a constant prefix and a variable project name "arzea", "bazezae", "abaze", "soian", etc.
|
please try to order your virtual folders by name ascending. In the edge version the order is fixed ( |
Hi @drakkan @nighoa
I am currently using version 0.0.11 of the provider. I first got the error with version 0.0.8, so I decided to upgrade, but the error still remains. Any additional suggestions to fix the problem? |
Hi again, I was able to solve the problem by using the workaround of sorting the virtual folders alphabetically, as you suggested @drakkan Thanks a lot |
Hi Drakkan,
First of all thanks a million for you work on this product SFTPGo and this provider that is in early stage 0.0.8 and do already a lot of good work.
I having a pretty bad issue of idempotency with the "virtual_folders" in the ressource sftpgo_group, by example :
The order is not the same between Terraform and the group in SFTPGo.
The ID seems to be the name in a type list, we should add the name as key of each element in a map (I think).
`
resource "sftpgo_group" "reader_project" {
name = "/Reader/${var.project_name}"
description = "Keycloak /Reader/${var.project_name}"
user_settings = {
max_sessions = 10
filters = {
denied_protocols = ["FTP", "DAV"]
web_client = ["write-disabled", "password-change-disabled"]
start_directory = "/tmp/group"
}
virtual_folders = [
{
name = "prod_bdd_backup_${var.project_name}"
virtual_path = "/tmp/group/prod_bdd_backup_root_folder/${var.project_name}"
quota_size = 0
quota_files = 0
},
{
name = "horsprod_bdd_backup_${var.project_name}"
virtual_path = "/tmp/group/horsprod_bdd_backup_root_folder/${var.project_name}"
quota_size = 0
quota_files = 0
}
]
}`
Terraform output example :
╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to module.sftpgo_groups_oidc["project1"].sftpgo_group.reader_project, provider "provider[\"registry.terraform.io/drakkan/sftpgo\"]" produced an unexpected new value: .virtual_folders[1].name: was │ cty.StringVal("horsprod_bdd_backup_project1"), but now cty.StringVal("prod_bdd_backup_project1"). │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ ╷ │ Error: Error creating group │ │ with module.sftpgo_groups_oidc["project2"].sftpgo_group.reader_project, │ on ../../../scw-tf-modules/sftpgo-oidc-project-policies/groups_keycloak_project.tf line 9, in resource "sftpgo_group" "reader_project": │ 9: resource "sftpgo_group" "reader_project" { │ │ Could not create group, unexpected error: status: 500, body: {"error":"Error 1213 (40001): Deadlock found when trying to get lock; try restarting transaction","message":""}
I don't know if it's expected, or if I have a bad implementation on my side, but at this time it's impossible to define multiple "Virtual folder" in this ressource, because the idempotency is not respected.
If you already have figured this bug and you have time to address it one day, keep me in touch if I can help you.
Best regards,
Nighoa
The text was updated successfully, but these errors were encountered: