Skip to content

tagesspiegel/terraform-argocd-application-set

Repository files navigation

ArgoCD Application Set

This module creates an applicationSet in an ArgoCD instance.

Config schema for ApplicationSet

Required fields:

values: |
  # Here you can define the values for the chart

Optional fields:

namespace_overwrite: <namespace>      # e.g. default (default: generated based on the project name + git folder name). Must be set if more than one environment is deployed in the same cluster.
chart:
  repo: <chart_repo_url>               # e.g. registry.hub.docker.com/tagesspiegel
  name: <chart_name>                   # e.g. background
  version: <chart_version>             # e.g. 1.0.0
  release_name: <chart_release_name>   # e.g. background-develop

Usage

provider "argocd" {
  server_addr = "argo.example.com"
  auth_token  = "my-token"
  grpc_web    = true
}

module "namespace-management" {
  source  = "tagesspiegel/application-set/argocd"
  version = "1.0.0"
  # insert the required variable here
}

With values.yaml

From module version v1.4.0 we also support the usage of a values.yaml file. By default, if you configured the git generator, we will look for a values.yaml inside the values folder next to the configured argocd application configuration. The values.yaml file will be named after the Helm release name (dashes are replaced by underscores).

|--- argo
|    |--- values
|    |    |--- argocd.yaml
|    |--- argocd.yaml (chart.release_name: argocd)

Cluster selection

The cluster selection is based on the ``

Requirements

Name Version
argocd 6.2.0

Providers

Name Version
argocd 6.2.0

Modules

No modules.

Resources

Name Type
argocd_application_set.this resource

Inputs

Name Description Type Default Required
annotations Annotations to apply to the application set map(string) {} no
application_name_suffix Optional suffix to add to the application name. This is useful if you want to deploy the same application multiple times to the same cluster. The suffix is added to the application name after the cluster name. e.g. prometheus-staging-. ArgoCD based gotemplating is supported. e.g. {{ index .path.segments 2 }} string null no
env_context_annotations A map of annotations that are rendered via go template. Available variables are cluster, resourceName and applicationName. You can access the variables using go templating. e.g. {{ $cluster }}, {{ $resourceName }}, {{ $applicationName }} map(string) {} no
generator The generator configuration. Only one generator can be used at a time.
object({
git = optional(object({
repo_url = string
revision = string
files = optional(list(string))
directories = optional(list(object({
path = string
exclude = bool
})))
}))
pull_request = optional(list(object({
requeue_after_seconds = number
repo = string
labels = list(string)
})))
})
n/a yes
generator_segment_index_overwrite Optional generator setting to override the index path segment during path selection. This option should only be set if generator.git.directories is used. Otherwise it should be left empty as it may affect the behavior. If this option is set in combination with generator.git.directories and your repository contains the cluster folder name in its root directory, this option should be set to 0. In all other cases, this option should reflect the index segment level to the directory corresponding to the cluster name. number null no
ignore_difference A list of object kinds to ignore during the diff process. This is useful if you want to ignore certain differences between the application set and the cluster. e.g. if you want to ignore differences in the namespace labels.
list(object({
group = optional(string)
jq_path_expressions = optional(list(string))
json_pointers = optional(list(string))
kind = optional(string)
name = optional(string)
namespace = optional(string)
}))
null no
labels Labels to apply to the application set map(string) {} no
manifest_source n/a
object({
helm = optional(object({
chart = string
repo_url = string
target_revision = string
release_name = string
}))
directory = optional(object({
repo = object({
url = string
revision = string
path = string
})
glob_path = optional(string)
}))
})
n/a yes
name The name of the application set string n/a yes
namespace The namespace the application set should be deployed to. string "argo-system" no
namespace_annotations Annotations to apply to the namespace. Only used if create_namespace is set to true. map(string) {} no
namespace_labels Labels to apply to the namespace. Only used if sync_options.* CreateNamespace=true is set. map(string) {} no
project_name The name of the ArgoCD project to use for this application set. If not set, this application set is special. Special application sets are managed by the platform team and therefore the ArgoCD project reference is handled differently to normal application sets. A major difference is that the ArgoCD project is not statically defined as reference but dynamically via the config directory name. string n/a yes
sync_options The sync options to use list(string)
[
"Validate=false",
"ApplyOutOfSyncOnly=true",
"CreateNamespace=true"
]
no
sync_policy ArgoCD sync policy configuration
object({
prune = bool
self_heal = bool
allow_empty = bool
})
null no
sync_retries The retry configuration for the sync policy
object({
duration = string
max_duration = string
factor = number
limit = number
})
{
"duration": "30s",
"factor": 2,
"limit": 5,
"max_duration": "2m"
}
no
target_namespace_overwrite The target namespace to use. If not set, the namespace is derived from the application set and git folder name. string "" no

Outputs

No outputs.