-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Terraform Version, ArgoCD Provider Version and ArgoCD Version
Terraform version: 1.14.0
ArgoCD provider version: 7.11.2
ArgoCD version: v3.1.9+8665140
Affected Resource(s)
- argocd_application_set
Terraform Configuration Files
variable "argocd_application_set" {
type = map(object({
annotations = optional(map(string))
labels = optional(map(string))
namespace = optional(string, "argocd")
go_template = optional(bool)
go_template_options = optional(set(string))
project = optional(string, "default")
template_metadata_name = optional(string, "{{path.basename}}")
source_repo_url = string
source_target_revision = optional(string, "main")
source_path = string
value_files_source_repo_url = optional(string)
value_files_source_ref = optional(string)
value_files_source_path = optional(string)
value_files_source_target_revision = optional(string, "HEAD")
helm_value_files = optional(list(string))
destination_server = string
destination_namespace = optional(string)
sync_options = optional(list(string))
git = optional(list(object({
repo_url = string
path_param_prefix = optional(string)
revision = optional(string)
values = optional(map(string))
directory = optional(list(object({
path = string
exclude = optional(bool)
})), [])
file = optional(list(object({
path = string
})), [])
})), [])
parameter = optional(list(object({
name = optional(string)
value = optional(string)
})), [])
sync_policy_automated = optional(object({
prune = optional(bool)
self_heal = optional(bool)
}), null)
}))
default = {}
}
resource "argocd_application_set" "application_set" {
for_each = { for key, value in var.argocd_application_set : key => value }
metadata {
name = each.key
namespace = each.value.namespace
labels = each.value.labels
annotations = each.value.annotations
}
spec {
go_template = each.value.go_template
go_template_options = each.value.go_template_options
generator {
dynamic "git" {
for_each = each.value.git
content {
repo_url = git.value.repo_url
revision = git.value.revision
path_param_prefix = git.value.path_param_prefix
values = git.value.values
dynamic "directory" {
for_each = git.value.directory
content {
path = directory.value.path
exclude = directory.value.exclude
}
}
dynamic "file" {
for_each = git.value.file
content {
path = file.value.path
}
}
}
}
}
template {
metadata {
name = each.value.template_metadata_name
}
spec {
project = each.value.project
sync_policy {
dynamic "automated" {
for_each = each.value.sync_policy_automated != null ? [each.value.sync_policy_automated] : []
content {
prune = automated.value.prune
self_heal = automated.value.self_heal
}
}
sync_options = each.value.sync_options
}
source {
repo_url = each.value.source_repo_url
target_revision = each.value.source_target_revision
path = each.value.source_path
helm {
dynamic "parameter" {
for_each = each.value.parameter
content {
name = parameter.value.name
value = parameter.value.value
}
}
value_files = each.value.helm_value_files
}
}
source {
repo_url = each.value.value_files_source_repo_url
target_revision = each.value.value_files_source_target_revision
ref = each.value.value_files_source_ref
path = each.value.value_files_source_path
}
destination {
server = each.value.destination_server
namespace = each.value.destination_namespace
}
}
}
}
}
module "argocd-resources" {
source = "../modules/devops/argocd"
depends_on = [module.argocd-basic-resources]
argocd_application = {
"prod-pm" = {
project = "pm"
namespace = "appset-argocd-prod-sbermobile"
source_repo_url = "https://gitlab.sb-tel.local/devops/helm-chart.git"
source_path = "."
helm_value_files = ["$values/values/prod/{{path.basename}}/values.yaml"]
value_files_source_repo_url = "https://gitlab.sb-tel.local/pm/kube-values.git"
value_files_source_ref = "values"
value_files_source_target_revision = "master"
destination_server = var.k8s_prod_server
destination_namespace = "prod-pm"
source_target_revision = "master"
git = [{
repo_url = "https://gitlab.sb-tel.local/pm/kube-values.git"
revision = "master"
directory = [{
path = "values/prod/*"
}]
}]
sync_policy_automated = {
prune = false
self_heal = false
}
},
}
}Panic Output
│ Error: failed to update application set prod-pm
│
│ with module.argocd-resources.argocd_application_set.application_set["prod-pm"],
│ on ..\modules\devops\argocd\application-set.tf line 1, in resource "argocd_application_set" "application_set":
│ 1: resource "argocd_application_set" "application_set" {
│
│ rpc error: code = Internal desc = unable to check existing ApplicationSet details: applicationsets.argoproj.io "prod-pm" not found
Steps to Reproduce
create resorce in another namespace and change it
Expected Behavior
it works correct
Actual Behavior
I don't know why, but when I try to change an Application Set created via terraform in a different namespace, I get the error described above, but when I create a resource for the first time, everything goes well, but I get this error when I try to change the same resource that was successfully created.
Important Factoids
I'll repeat once again, this resource is created successfully and absolutely correctly. The error only occurs when I try to change this resource through terraform.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working