Skip to content

Commit

Permalink
feat: allow value files and value object properties (#16)
Browse files Browse the repository at this point in the history
* feat: implemented values file handling for applications

Signed-off-by: leonsteinhaeuser <leon.steinhaeuser@tagesspiegel.de>

* docs: added instructions how to use values.yaml files

Signed-off-by: leonsteinhaeuser <leon.steinhaeuser@tagesspiegel.de>

---------

Signed-off-by: leonsteinhaeuser <leon.steinhaeuser@tagesspiegel.de>
  • Loading branch information
leonsteinhaeuser authored Feb 22, 2024
1 parent 826dc43 commit 495fae4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ module "namespace-management" {
}
```

### 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).

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

## Cluster selection

The cluster selection is based on the ``
Expand Down
11 changes: 11 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ resource "argocd_application_set" "this" {
helm {
release_name = "{{ default \"${var.manifest_source.helm.release_name}\" .chart.release_name }}"
values = "{{ .values }}"
// optional properties only if the git generator is not null
value_files = var.generator.git != null ? ["$values/{{ .path.path }}/values/{{ default \"${var.manifest_source.helm.release_name}\" .chart.release_name | replace \"-\" \"_\"}}.yaml"] : []
ignore_missing_value_files = var.generator.git != null ? true : false
}
}
}
Expand All @@ -105,6 +108,14 @@ resource "argocd_application_set" "this" {
}
}
}
dynamic "source" {
for_each = var.generator.git != null ? [var.generator.git] : []
content {
repo_url = var.generator.git.repo_url
target_revision = var.generator.git.revision
ref = "values"
}
}

dynamic "ignore_difference" {
// to protect against null values, we need to check if the ignore_difference block is not null
Expand Down

0 comments on commit 495fae4

Please sign in to comment.