devops-stack-module-applicationset
A DevOps Stack module to deploy a generic ApplicationSet in Argo CD.
Usage
You can instantiate this module using the example below:
module "helloworld_apps" {
source = "git::https://github.com/camptocamp/devops-stack-module-applicationset.git"
depends_on = [module.argocd]
name = "helloworld-apps"
argocd_namespace = local.argocd_namespace
project_dest_namespace = "*"
project_source_repos = [
"https://github.com/camptocamp/devops-stack-helloworld-templates.git",
]
generators = [
{
git = {
repoURL = "https://github.com/camptocamp/devops-stack-helloworld-templates.git"
revision = "main"
directories = [
{
path = "apps/*"
}
]
}
}
]
template = {
metadata = {
name = "{{path.basename}}"
}
spec = {
project = "helloworld-apps"
source = {
repoURL = "https://github.com/camptocamp/devops-stack-helloworld-templates.git"
targetRevision = "main"
path = "{{path}}"
helm = {
valueFiles = ["values.yaml","secrets.yaml"]
# The following value defines this global variables that will be available to all apps in apps/*
# These are needed to generate the ingresses containing the name and base domain of the cluster.
values = <<-EOT
cluster:
name: "${module.eks.cluster_name}"
domain: "${module.eks.base_domain}"
EOT
}
}
destination = {
name = "in-cluster"
namespace = "{{path.basename}}"
}
syncPolicy = {
automated = {
allowEmpty = false
selfHeal = true
prune = true
}
syncOptions = [
"CreateNamespace=true"
]
}
}
}
}
This module first creates an Argo CD AppProject called helloworld-apps
that will contain all other resources.
Then, it creates an Application called helloworld-apps
that itself only contains an homonymous ApplicationSet, which is created from the chart inside this repository and using the variables given on the instantiation (, name
, generators
, and template
).

It is this ApplicationSet that will contain all the applications you have in the repository you defined in repoURL
, in this example is helloworld
.

As you can see, the ApplicationSet template we give here is flexible enough that it can be configured as you like. For example, since we defined the path in the generator as a wildcard apps/*
, we can also take this value to then name each application created depending on name of the folder where the chart is located.
Technical Reference
Resources
The following resources are used by this module:
-
argocd_application.this (resource)
-
argocd_project.this (resource)
-
null_resource.this (resource)
Required Inputs
The following input variables are required:
argocd_namespace
Description: Namespace used by Argo CD where the Application and AppProject resources should be created.
Type: string
name
Description: Name to give the AppProject and ApplicationSet (tecnically there is also an Application where the ApplicationSet will reside that will get the same name).
Type: string
Optional Inputs
The following input variables are optional (have default values):
project_dest_namespace
Description: Allowed destination namespace in the AppProject.
Type: string
Default: "*"
project_source_repos
Description: List of repositories allowed to be scraped in this AppProject.
Type: list(string)
Default:
[
"*"
]
Outputs
The following outputs are exported:
id
Description: ID to pass other modules in order to refer to this module as a dependency.
Reference in table format
Show tables
= Providers
Name | Version |
---|---|
n/a |
|
n/a |
= Resources
Name | Type |
---|---|
resource |
|
resource |
|
resource |
= Inputs
Name | Description | Type | Default | Required |
---|---|---|---|---|
Namespace used by Argo CD where the Application and AppProject resources should be created. |
|
n/a |
yes |
|
ApplicationSet generators. |
|
n/a |
yes |
|
Name to give the AppProject and ApplicationSet (tecnically there is also an Application where the ApplicationSet will reside that will get the same name). |
|
n/a |
yes |
|
Allowed destination namespace in the AppProject. |
|
|
no |
|
List of repositories allowed to be scraped in this AppProject. |
|
|
no |
|
ApplicationSet template. |
|
n/a |
yes |
= Outputs
Name | Description |
---|---|
ID to pass other modules in order to refer to this module as a dependency. |