wso2 / wso2/open-cloud-datacenter
fix(bootstrap): enforce harvester_kubeconfig_path when manage_storage_class = true
Nobody has claimed this yet.
- Dominant language
- HCL
- Stars
- 19
- Forks
- 15
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 4
Description
Summary
The variable harvester_kubeconfig_path in modules/bootstrap/variables.tf is documented as required when manage_storage_class = true, but no enforcement exists. This causes null_resource.patch_longhorn_sc in main.tf to run with an empty KUBECONFIG environment variable, resulting in a runtime failure.
Fix
Add a check block in modules/bootstrap/main.tf to enforce the requirement (cross-variable validations are not supported in variable blocks):
check "harvester_kubeconfig_path_required" {
assert {
condition = !var.manage_storage_class || var.harvester_kubeconfig_path != ""
error_message = "harvester_kubeconfig_path is required when manage_storage_class = true. Set KUBECONFIG to a valid Harvester kubeconfig path."
}
}
References
- PR: https://github.com/wso2/open-cloud-datacenter/pull/84
- Review comment: https://github.com/wso2/open-cloud-datacenter/pull/84#discussion_r3167420924
- 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.
Research direction
Start in modules/bootstrap/main.tf and review the null_resource.patch_longhorn_sc behavior described in the issue, then compare it with the variable documentation in modules/bootstrap/variables.tf. Add the requested cross-variable validation and verify that storage-class management requires a non-empty kubeconfig path while the other case remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- terraform
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100