Skip to content

Commit

Permalink
Merge pull request #10 from T-Systems-MMS/more_resources
Browse files Browse the repository at this point in the history
add more attributes
  • Loading branch information
michaelamattes authored Aug 15, 2022
2 parents 792e02d + 3a2349c commit 54be60a
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 42 deletions.
63 changes: 41 additions & 22 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,63 @@ resource "helm_release" "release" {
for_each = var.helm_release

name = local.helm_release[each.key].name == "" ? each.key : local.helm_release[each.key].name
namespace = local.helm_release[each.key].namespace
repository = local.helm_release[each.key].repository
chart = local.helm_release[each.key].chart
version = local.helm_release[each.key].version
description = local.helm_release[each.key].description
wait = local.helm_release[each.key].wait
reuse_values = local.helm_release[each.key].reuse_values
reset_values = local.helm_release[each.key].reset_values
force_update = local.helm_release[each.key].force_update
recreate_pods = local.helm_release[each.key].recreate_pods
cleanup_on_fail = local.helm_release[each.key].cleanup_on_fail
max_history = local.helm_release[each.key].max_history
dependency_update = local.helm_release[each.key].dependency_update
replace = local.helm_release[each.key].replace
namespace = local.helm_release[each.key].namespace
chart = local.helm_release[each.key].chart
repository = local.helm_release[each.key].repository
repository_key_file = local.helm_release[each.key].repository_key_file
repository_cert_file = local.helm_release[each.key].repository_cert_file
repository_ca_file = local.helm_release[each.key].repository_ca_file
repository_username = local.helm_release[each.key].repository_username
repository_password = local.helm_release[each.key].repository_password
devel = local.helm_release[each.key].devel
version = local.helm_release[each.key].version
verify = local.helm_release[each.key].verify
keyring = local.helm_release[each.key].keyring
timeout = local.helm_release[each.key].timeout
disable_webhooks = local.helm_release[each.key].disable_webhooks
reuse_values = local.helm_release[each.key].reuse_values
reset_values = local.helm_release[each.key].reset_values
force_update = local.helm_release[each.key].force_update
recreate_pods = local.helm_release[each.key].recreate_pods
cleanup_on_fail = local.helm_release[each.key].cleanup_on_fail
max_history = local.helm_release[each.key].max_history
atomic = local.helm_release[each.key].atomic
skip_crds = local.helm_release[each.key].skip_crds
render_subchart_notes = local.helm_release[each.key].render_subchart_notes
disable_openapi_validation = local.helm_release[each.key].disable_openapi_validation
wait = local.helm_release[each.key].wait
wait_for_jobs = local.helm_release[each.key].wait_for_jobs
dependency_update = local.helm_release[each.key].dependency_update
replace = local.helm_release[each.key].replace
description = local.helm_release[each.key].description
lint = local.helm_release[each.key].lint
create_namespace = local.helm_release[each.key].create_namespace

lint = local.helm_release[each.key].lint
create_namespace = local.helm_release[each.key].create_namespace

values = local.helm_release[each.key].values
values = local.helm_release[each.key].values

dynamic "set" {
for_each = local.helm_release[each.key].set
content {
name = local.helm_release[each.key].set[set.key].name
name = local.helm_release[each.key].set[set.key].name == "" ? set.key : local.helm_release[each.key].set[set.key].name
value = local.helm_release[each.key].set[set.key].value
type = local.helm_release[each.key].set[set.key].type
}
}

dynamic "set_sensitive" {
for_each = local.helm_release[each.key].set_sensitive
content {
name = local.helm_release[each.key].set_sensitive[set_sensitive.key].name
name = local.helm_release[each.key].set_sensitive[set_sensitive.key].name == "" ? set_sensitive.key : local.helm_release[each.key].set_sensitive[set_sensitive.key].name
value = local.helm_release[each.key].set_sensitive[set_sensitive.key].value
type = local.helm_release[each.key].set_sensitive[set_sensitive.key].type
}
}

dynamic "postrender" {
for_each = local.helm_release[each.key].postrender
for_each = local.helm_release[each.key].postrender.binary_path != "" ? [1] : []
content {
binary_path = local.helm_release[each.key].postrender[postrender.key].binary_path
binary_path = local.helm_release[each.key].postrender.binary_path
args = local.helm_release[each.key].postrender.args
}
}
}
69 changes: 49 additions & 20 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,47 @@ locals {
helm_release = {
name = ""
namespace = "default"
repository = ""
chart = ""
description = ""
version = "latest"
wait = true
reuse_values = false
reset_values = false
force_update = false
recreate_pods = false
cleanup_on_fail = false
max_history = 0
dependency_update = false
replace = false
lint = false
create_namespace = false
values = []
set = {}
set_sensitive = {}
postrender = {}
repository = null
repository_key_file = null
repository_cert_file = null
repository_ca_file = null
repository_username = null
repository_password = null
devel = null
verify = null
keyring = null
timeout = null
disable_webhooks = null
reuse_values = null
reset_values = true
force_update = true
recreate_pods = null
cleanup_on_fail = true
max_history = 3
atomic = null
skip_crds = null
render_subchart_notes = null
disable_openapi_validation = null
wait = true
wait_for_jobs = null
dependency_update = null
replace = null
description = null
lint = true
create_namespace = null
values = null
set = {
name = ""
type = null
}
set_sensitive = {
name = ""
type = null
}
postrender = {
binary_path = ""
args = null
}
}
}

Expand All @@ -43,8 +65,15 @@ locals {
helm_release => merge(
local.helm_release_values[helm_release],
{
for config in ["set", "set_sensitive", "postrender"] :
for config in ["postrender"] :
config => merge(local.default.helm_release[config], local.helm_release_values[helm_release][config])
},
{
for config in ["set", "set_sensitive"] :
config => {
for key in keys(lookup(var.helm_release[helm_release], config, {})) :
key => merge(local.default.helm_release[config], local.helm_release_values[helm_release][config][key])
}
}
)
}
Expand Down

0 comments on commit 54be60a

Please sign in to comment.