-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(modules): set variable default values #6
Conversation
I got an idea for this to take it forward. Phase 1: Manual alignment
Phase 2: Automation
|
b71a533
to
a15e6c0
Compare
.tool-versions
Outdated
@@ -4,3 +4,4 @@ tflint 0.50.3 | |||
checkov 3.2.37 | |||
awscli 2.15.29 | |||
pre-commit 3.6.2 | |||
python 3.9.16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.9 is nearing end-of-life, can't we use newer version?
https://devguide.python.org/versions/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, I should update my tool as well :-) Will do
modules/addon-irsa/iam.tf
Outdated
format("system:serviceaccount:%s:%s", var.service_account_namespace != null ? var.service_account_namespace : "", var.service_account_name != null ? var.service_account_name : "") | ||
] | ||
irsa_role_create = var.enabled && var.rbac_create && var.service_account_create && var.irsa_role_create | ||
irsa_role_name_prefix = coalesce(var.irsa_role_name_prefix, "${module.label.id}-irsa") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not "" default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""
would simplify it and I am fine with it, so be it
modules/addon-irsa/variables.tf
Outdated
default = null | ||
description = "IRSA role name prefix. Defaults to addon IRSA component name with `irsa` suffix." | ||
default = "" | ||
description = "IRSA role name prefix. Defaults to addon IRSA component name (if provided) with `irsa` suffix." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it should construct a name if the values is ""...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if the role name would end up empty, Terraform plan will fail, I think this is OK behaviour, or?
modules/addon-irsa/variables.tf
Outdated
} | ||
|
||
variable "irsa_permissions_boundary" { | ||
type = string | ||
default = null | ||
description = "ARN of the policy that is used to set the permissions boundary for the IRSA role. Defaults to `\"\"`." | ||
description = "ARN of the policy that is used to set the permissions boundary for the IRSA role." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null or "" as default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need null
otherwise Terraform plan fails on invalid perm boundary name
modules/addon-oidc/iam.tf
Outdated
oidc_assume_role_enabled = var.oidc_assume_role_enabled == true && try(length(var.oidc_assume_role_arns) > 0, false) | ||
oidc_provider_create = var.enabled && var.oidc_provider_create | ||
oidc_role_create = var.enabled && var.oidc_role_create | ||
oidc_role_name_prefix = coalesce(var.oidc_role_name_prefix, "${module.label.id}-oidc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same concern as with irsa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
modules/addon-oidc/variables.tf
Outdated
} | ||
|
||
variable "oidc_policy" { | ||
type = string | ||
default = null | ||
default = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an example of the policy format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more clear wording
variables-addon.tf
Outdated
variable "argo_kubernetes_manifest_computed_fields" { | ||
type = list(string) | ||
default = null | ||
description = "List of paths of fields to be handled as \"computed\". The user-configured value for the field will be overridden by any different value returned by the API after apply. Defaults to `[\"metadata.labels\", \"metadata.annotations\", \"metadata.finalizers\"]`." | ||
description = "List of paths of fields to be handled as \"computed\". The user-configured value for the field will be overridden by any different value returned by the API after apply. Defaults to `['metadata.labels', 'metadata.annotations', 'metadata.finalizers']`." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the single quotes ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to improve this
variables-addon.tf
Outdated
default = null | ||
description = "ArgoCD info manifest parameter. Defaults to `[{name=\"terraform\",value=true}]`." | ||
description = "ArgoCD Application manifest info parameter. Defaults to `[{'name': 'terraform', 'value': 'true'}]`." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the single quotes ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #6 (comment)
57900cd
to
5a3dd5a
Compare
modules/addon-irsa/variables.tf
Outdated
default = null | ||
description = "IRSA role name. The value is prefixed by `var.irsa_role_name_prefix`. Defaults to addon Helm chart name." | ||
default = "" | ||
description = "IRSA role name. The value is prefixed by `irsa_role_name_prefix`." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment that at least one of name or prefix have to be set
3189f60
to
d204cca
Compare
Description
This PRs sets default values of internal module variables and adds automation of syncing these variables with the integration part.
The automated creation of actual integration part
addon[-irsa|oidc].tf
is quite tricky and will demand substantial work, so this task will be deferred to another PR.Type of change
fix
)feat
)refactor
)test
)style
)ci
)docs
)How Has This Been Tested?