Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions argocd/resource_argocd_application_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) },
Expand Down Expand Up @@ -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" {
Expand Down
5 changes: 5 additions & 0 deletions argocd/schema_application_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ func applicationSetGitGeneratorSchemaV0() *schema.Schema {
Description: "Revision of the source repository to use.",
Optional: true,
},
"requeue_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.",
Expand Down