argocd_application_set failed due to error `spec.generator.git`
noymmm opened this issue · 3 comments
noymmm commented
Terraform Version, ArgoCD Provider Version and ArgoCD Version
Terraform version: v1.6.6
ArgoCD provider version: 6.0.3
ArgoCD version: 2.8
Affected Resource(s)
- argocd_application_set
Terraform Configuration Files
resource "argocd_application_set" "app_set_files" {
id = (known after apply)
metadata {
generation = (known after apply)
name = "<replaced>"
namespace = (known after apply)
resource_version = (known after apply)
uid = (known after apply)
}
spec {
generator {
git {
repo_url = "https://github.com/<replaced>.git"
revision = "HEAD"
file {
path = "argocd/**/<replaced>.yaml"
}
}
}
template {
metadata {
name = "<replaced>-{{path.basename}}"
}
spec {
project = "<replaced>"
revision_history_limit = 10
destination {
namespace = "argocd"
server = "<replaced>"
}
ignore_difference {
group = "argoproj.io"
json_pointers = [
"/metadata",
"/spec",
]
kind = "AppProject"
}
source {
path = "argocd/{{path.basename}}"
repo_url = "https://github.com/<replaced>.git"
target_revision = "HEAD"
helm {
release_name = "{{path.basename}}"
value_files = [
"values-global.yaml",
"<replaced>.yaml",
]
}
}
}
}
}
}
Debug Output
Steps to Reproduce
terraform apply
Expected Behavior
- ApplicationSet created
Actual Behavior
│ Error: Insufficient template blocks
│
│ on ../../../components/argocd/application_set/application_set.tf line 15, in resource "argocd_application_set" "app_set_files":
│ 15: spec {
│
│ At least 1 "template" blocks are required.
╵
References
chidambaram27 commented
It actually works for me, I guess the scope of template needs to be corrected
resource "argocd_application_set" "cluster_addons" {
metadata {
name = "guestbook-tf"
namespace = "argocd"
}
spec {
go_template = true
generator {
git {
template {
spec {
project = "project-name-override"
destination {}
}
metadata {}
}
file {
path = "applicationset/examples/git-generator-files-discovery/cluster-config/**/config.json"
}
revision = "HEAD"
repo_url = "https://github.com/argoproj/argo-cd.git"
}
}
template {
metadata {
name = "spec-template-tf"
}
spec {
source {
repo_url = "https://github.com/argoproj/argo-cd.git"
target_revision = "HEAD"
path = "applicationset/examples/list-generator/guestbook/engineering-dev"
}
destination {
server = "https://kubernetes.default.svc"
namespace = "guestbook"
}
}
}
}
}
onematchfox commented
@noymmm can you please supply the actual Terraform configuration you are using rather than the plan output? I suspect @chidambaram27 is correct here but can't say for certain without being able to reproduce the issue.
github-actions commented
This issue is stale because of a lack of response from the original author. Please provide the requested feedback or this will be closed in 10 days.