From b49b89b12baf512f6124f0e8208f275a818cdd9f Mon Sep 17 00:00:00 2001 From: chansuke Date: Sun, 24 Aug 2025 12:12:26 +0900 Subject: [PATCH 1/4] feat: add `requeueAfterSeconds` to spec.generator.matrix.generator.matrix.generator.git schema Signed-off-by: chansuke --- .../resource_argocd_application_set_test.go | 114 ++++++++++++++++++ argocd/schema_application_set.go | 5 + 2 files changed, 119 insertions(+) diff --git a/argocd/resource_argocd_application_set_test.go b/argocd/resource_argocd_application_set_test.go index 2fa7fd4f..3460259c 100644 --- a/argocd/resource_argocd_application_set_test.go +++ b/argocd/resource_argocd_application_set_test.go @@ -376,6 +376,47 @@ func TestAccArgoCDApplicationSet_matrixNested(t *testing.T) { }) } +func TestAccArgoCDApplicationSet_matrixNestedGitRequeueAfterSeconds(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckFeatureSupported(t, features.ApplicationSet) }, + ProviderFactories: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccArgoCDApplicationSet_matrixNestedGitRequeueAfterSeconds(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "argocd_application_set.matrix_nested_git_requeue", + "metadata.0.uid", + ), + resource.TestCheckResourceAttrSet( + "argocd_application_set.matrix_nested_git_requeue", + "spec.0.generator.0.matrix.0.generator.0.clusters.0.selector.0.match_labels.%", + ), + resource.TestCheckResourceAttrSet( + "argocd_application_set.matrix_nested_git_requeue", + "spec.0.generator.0.matrix.0.generator.1.matrix.0.generator.0.git.0.repo_url", + ), + resource.TestCheckResourceAttr( + "argocd_application_set.matrix_nested_git_requeue", + "spec.0.generator.0.matrix.0.generator.1.matrix.0.generator.0.git.0.requeue_after_seconds", + "600", + ), + resource.TestCheckResourceAttrSet( + "argocd_application_set.matrix_nested_git_requeue", + "spec.0.generator.0.matrix.0.generator.1.matrix.0.generator.1.list.0.elements.0.cluster", + ), + ), + }, + { + ResourceName: "argocd_application_set.matrix_nested_git_requeue", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"metadata.0.resource_version"}, + }, + }, + }) +} + func TestAccArgoCDApplicationSet_matrixInvalid(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckFeatureSupported(t, features.ApplicationSet) }, @@ -1669,6 +1710,79 @@ resource "argocd_application_set" "matrix_nested" { }` } +func testAccArgoCDApplicationSet_matrixNestedGitRequeueAfterSeconds() string { + return ` +resource "argocd_application_set" "matrix_nested_git_requeue" { + metadata { + name = "matrix-nested-git-requeue" + } + + spec { + generator { + matrix { + generator { + clusters{ + selector { + match_labels = { + argocd.argoproj.io/secret-type = "cluster" + } + } + } + } + + generator { + matrix { + generator { + git { + repo_url = "https://github.com/argoproj/argo-cd.git" + revision = "HEAD" + requeue_after_seconds = 600 + + directory { + path = "applicationset/examples/matrix/cluster-addons/*" + } + } + } + + generator { + list { + elements = [ + { + cluster = "engineering-dev" + url = "https://kubernetes.default.svc" + } + ] + } + } + } + } + } + } + + template { + metadata { + name = "nested-{{path.basename}}-{{name}}" + } + + spec { + project = "default" + + source { + repo_url = "https://github.com/argoproj/argo-cd.git" + target_revision = "HEAD" + path = "{{path}}" + } + + destination { + server = "{{server}}" + namespace = "{{path.basename}}" + } + } + } + } +}` +} + func testAccArgoCDApplicationSet_matrixInsufficientGenerators() string { return ` resource "argocd_application_set" "matrix_insufficient_generators" { diff --git a/argocd/schema_application_set.go b/argocd/schema_application_set.go index a52c7ca8..cfef647b 100644 --- a/argocd/schema_application_set.go +++ b/argocd/schema_application_set.go @@ -409,6 +409,11 @@ func applicationSetGitGeneratorSchemaV0() *schema.Schema { Description: "Revision of the source repository to use.", Optional: true, }, + "resque_after_seconds": { + Type: schema.TypeInt, + Description: "Interval in second for the ApplicationSet to poll the Git repository.", + Optional: true, + }, "path_param_prefix": { Type: schema.TypeString, Description: "Prefix for all path-related parameter names.", From 1604df97f6c8b4a1134f611fa67e21b2425c14c5 Mon Sep 17 00:00:00 2001 From: chansuke Date: Sun, 24 Aug 2025 23:06:23 +0900 Subject: [PATCH 2/4] fix: typo s/resque_after_seconds/requeue_after_seconds/ Signed-off-by: chansuke --- argocd/schema_application_set.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argocd/schema_application_set.go b/argocd/schema_application_set.go index cfef647b..2d6c0418 100644 --- a/argocd/schema_application_set.go +++ b/argocd/schema_application_set.go @@ -409,7 +409,7 @@ func applicationSetGitGeneratorSchemaV0() *schema.Schema { Description: "Revision of the source repository to use.", Optional: true, }, - "resque_after_seconds": { + "requeue_after_seconds": { Type: schema.TypeInt, Description: "Interval in second for the ApplicationSet to poll the Git repository.", Optional: true, From d88e6c4959879a3e693c0edf583fec5447f45c10 Mon Sep 17 00:00:00 2001 From: chansuke Date: Sun, 24 Aug 2025 23:38:47 +0900 Subject: [PATCH 3/4] feat: add `insecure` and `caRef` to generator Gitlab --- argocd/schema_application_set.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/argocd/schema_application_set.go b/argocd/schema_application_set.go index 2d6c0418..21d743ba 100644 --- a/argocd/schema_application_set.go +++ b/argocd/schema_application_set.go @@ -999,6 +999,18 @@ func applicationSetPullRequestGeneratorSchemaV0() *schema.Schema { MaxItems: 1, Elem: secretRefResource(), }, + "insecure": { + Type: schema.TypeBool, + Description: "A flag for checking the validity of the SCM's certificates.", + Required: true, + Default: false, + }, + "ca_ref": { + Type: schema.TypeList, + Description: "Authentication token reference.", + Optional: true, + Elem: configMapRefResource(), + }, }, }, }, @@ -1083,3 +1095,20 @@ func secretRefResource() *schema.Resource { }, } } + +func configMapRefResource() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Description: "Key containing information in trusted CA certs.", + Required: true, + }, + "config_map_name": { + Type: schema.TypeString, + Description: "Name of the ConfigMap.", + Required: true, + }, + }, + } +} From d5ba37d388efc50df31b7c87671ef0e3c98d756c Mon Sep 17 00:00:00 2001 From: chansuke Date: Mon, 25 Aug 2025 23:21:11 +0900 Subject: [PATCH 4/4] chore: generate doc Signed-off-by: chansuke --- docs/resources/application_set.md | 84 +++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/docs/resources/application_set.md b/docs/resources/application_set.md index b5a3ed7f..c1bd02f9 100644 --- a/docs/resources/application_set.md +++ b/docs/resources/application_set.md @@ -1237,6 +1237,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -2458,6 +2459,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -3677,6 +3679,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--matrix--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--matrix--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--matrix--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -4654,15 +4657,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--matrix--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--matrix--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.matrix.generator.matrix.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.matrix.generator.matrix.generator.pull_request.gitlab.token_ref` @@ -6328,6 +6342,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--merge--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--merge--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--merge--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -7305,15 +7320,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--merge--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--merge--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.matrix.generator.merge.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.matrix.generator.merge.generator.pull_request.gitlab.token_ref` @@ -8736,15 +8762,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--matrix--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.matrix.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.matrix.generator.pull_request.gitlab.token_ref` @@ -10412,6 +10449,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -11631,6 +11669,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--matrix--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--matrix--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--matrix--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -12608,15 +12647,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--matrix--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--matrix--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.merge.generator.matrix.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.merge.generator.matrix.generator.pull_request.gitlab.token_ref` @@ -14282,6 +14332,7 @@ Optional: - `directory` (Block List) List of directories in the source repository to use when template the Application.. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--merge--generator--git--directory)) - `file` (Block List) List of files in the source repository to use when template the Application. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--merge--generator--git--file)) - `path_param_prefix` (String) Prefix for all path-related parameter names. +- `requeue_after_seconds` (Number) Interval in second for the ApplicationSet to poll the Git repository. - `revision` (String) Revision of the source repository to use. - `template` (Block List, Max: 1) Generator template. Used to override the values of the spec-level template. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--merge--generator--git--template)) - `values` (Map of String) Arbitrary string key-value pairs to pass to the template via the values field of the git generator. @@ -15259,15 +15310,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--merge--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--merge--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.merge.generator.merge.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.merge.generator.merge.generator.pull_request.gitlab.token_ref` @@ -16690,15 +16752,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--merge--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.merge.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.merge.generator.pull_request.gitlab.token_ref` @@ -18121,15 +18194,26 @@ Required: Required: +- `insecure` (Boolean) A flag for checking the validity of the SCM's certificates. - `project` (String) GitLab project to scan. Optional: - `api` (String) The GitLab API URL to talk to. If blank, uses https://gitlab.com/. +- `ca_ref` (Block List) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--pull_request--gitlab--ca_ref)) - `labels` (List of String) Labels is used to filter the PRs that you want to target. - `pull_request_state` (String) additional MRs filter to get only those with a certain state. Default: "" (all states). - `token_ref` (Block List, Max: 1) Authentication token reference. (see [below for nested schema](#nestedblock--spec--generator--pull_request--gitlab--token_ref)) + +### Nested Schema for `spec.generator.pull_request.gitlab.ca_ref` + +Required: + +- `config_map_name` (String) Name of the ConfigMap. +- `key` (String) Key containing information in trusted CA certs. + + ### Nested Schema for `spec.generator.pull_request.gitlab.token_ref`