wso2 / wso2/open-cloud-datacenter

Add validation to reject empty/whitespace-only password in vm module

Open
#58 1 comment 0 reactions 1 assignee View on GitHub

@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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.