wso2 / wso2/open-cloud-datacenter
Add validation to reject empty/whitespace-only password in vm module
Open
@HiranAdikari is already working on this.
Since Apr 17, 2026.
- Dominant language
- HCL
- Stars
- 19
- Forks
- 15
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 4
Description
Summary
The password variable in modules/workloads/vm/variables.tf currently allows an empty string (""), which is treated as "set" in main.tf and can produce insecure/invalid cloud-init auth behavior. A validation block should be added to require null or a non-empty, non-whitespace string.
Proposed Fix
variable "password" {
type = string
description = "Password for the default_user, injected via chpasswd.list. Only used when user_data is null. Leave null to disable password auth."
default = null
sensitive = true
validation {
condition = var.password == null || length(trimspace(var.password)) > 0
error_message = "password must be null or a non-empty string."
}
}
References
- Flagged in PR #54 (https://github.com/wso2/open-cloud-datacenter/pull/54#discussion_r3092629323)
- Requested by @HiranAdikari
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.