-
Notifications
You must be signed in to change notification settings - Fork 90
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
Directory block not saved in state for multi-source applications #418
Comments
Thanks for reporting.
Update: require (
# ..
github.com/argoproj/argo-cd/v2 v2.9.21
github.com/argoproj/gitops-engine v0.7.3
github.com/argoproj/pkg v0.13.7-0.20230627120311-a4dd357b057e
# ..
) Then we need to make sure that the multi-source app is correctly reflected into TF. I will add the bug label again. |
@mkilchhofer - I'll pick this one up |
I was doing some testing and the issue actually happens regardless if it's a multi-source application or not. If you even have a single source with a directory block it will not save the configuration values for I have a sneaking suspicion it's due to the DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
// Avoid drift when recurse is explicitly set to false
// Also ignore the directory node if both recurse & jsonnet are not set or ignore
if k == "spec.0.source.0.directory.0.recurse" && oldValue == "" && newValue == "false" {
return true
}
if k == "spec.0.source.0.directory.#" {
_, hasRecurse := d.GetOk("spec.0.source.0.directory.0.recurse")
_, hasJsonnet := d.GetOk("spec.0.source.0.directory.0.jsonnet")
if !hasJsonnet && !hasRecurse {
return true
}
}
return false
}, @Ravitejareddykamidi - a quick workaround while we figure this out is to either set I'll do some more digging to figure out why exactly this is happening. My guess to why the |
Hi @tonedefdev, Thanks for the workaround suggestion! I set recurse = true and added the jsonnet block with the required values, and it worked perfectly. The configuration is now correctly detected in terraform plan without any issues. Appreciate the quick solution and your help in figuring this out! |
@Ravitejareddykamidi -- just wanted to clarify that you only need either the recurse option set to true or the jsonnnet block, not both |
Description:
I'm encountering an issue with the argocd Terraform provider (source: oboukili/argocd, version: 6.1.1) when trying to create a multi-source application. Specifically, the directory block for excluding and including files does not get saved in the Terraform state file. As a result, when I re-run terraform plan or terraform apply, it continuously shows that changes are required, even though no actual changes were made.
Terraform Version, ArgoCD Provider Version and ArgoCD Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Steps to Reproduce
Expected Behavior
The directory block should be saved in the Terraform state file after the first terraform apply, and no changes should be detected on subsequent terraform plan or terraform apply runs unless there are actual changes.
Actual Behavior
The directory block does not get saved in the Terraform state file, causing Terraform to continuously detect and attempt to apply changes related to this block on every terraform plan or terraform apply run, even though the ArgoCD UI already reflects the changes.
Terraform Plan shows the following every time:
Important Factoids
The directory block is already present in the ArgoCD UI and contains the correct values.
This behavior only affects the directory block, while other resources function as expected.
This happens when defining multiple sources within an ArgoCD application.
References
No specific references found yet.
Community Note
The text was updated successfully, but these errors were encountered: