-
Notifications
You must be signed in to change notification settings - Fork 89
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
block managed_namespace_metadata panic #492
Comments
the same error
|
So what exactly are you trying to acomplish that let's the provider crash? Would you mind adding some steps to reproduce the issue (including a full example resource)? |
what my resource looks like doesn’t matter; I get this error if the values of the passed variables remain empty and optional in the plugin block for example if i use dynamic and do apply
|
i resolve with example below but now i get this
|
|
can we ignore this block if fields are null ?
|
@the-technat can you watch this panic? |
Will do, but will take some days before I get time for it. |
does it correct behavior? |
any update? |
I can reproduce the panic using the following TF config: terraform {
required_providers {
argocd = {
source = "argoproj-labs/argocd"
version = "7.1.0"
}
}
}
provider "argocd" {
port_forward_with_namespace = "argocd"
username = "admin"
password = "acceptancetesting"
kubernetes {
config_context = "kind-argocd"
}
}
variable "multiple_sources_app" {
type = map(object({
managed_namespace_metadata_labels = optional(map(string))
managed_namespace_metadata_annotations = optional(map(string))
}))
default = {
managed_namespace_metadata_labels = {"foo" = "bar"}
}
}
resource "argocd_application" "reproduce" {
for_each = var.multiple_sources_app
metadata {
name = "kustomize-app"
namespace = "argocd"
labels = {
test = "true"
}
}
cascade = false # disable cascading deletion
wait = true
spec {
project = "default"
destination {
server = "https://kubernetes.default.svc"
namespace = "foo"
}
source {
repo_url = "https://github.com/kubernetes-sigs/kustomize"
path = "examples/helloWorld"
target_revision = "master"
}
sync_policy {
managed_namespace_metadata {
labels = each.value.managed_namespace_metadata_labels
annotations = each.value.managed_namespace_metadata_annotations
}
automated {
prune = true
self_heal = true
allow_empty = true
}
sync_options = ["Validate=false","CreateNamespace=true"]
}
}
} However I have no clue what this tells us. Will have to dig into this further. |
This type-conversion seems to cause the panic: https://github.com/argoproj-labs/terraform-provider-argocd/blob/main/argocd/structure_application.go#L406-L407. But I don't yet understand what kind of input it doesn't handle/expect and if that's actually something we need to catch there or something we don't expect to be passed in. |
maybe you should add a condition if the values of these variables are empty and nothing is passed to them, then simply ignore this block and perhaps indicate in the code that they are optional |
The text was updated successfully, but these errors were encountered: