Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
34 changes: 34 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 Expand Up @@ -994,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(),
},
},
},
},
Expand Down Expand Up @@ -1078,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,
},
},
}
}
Loading