feat(provider): clouds.yaml (cloud / OS_CLOUD) support - #12
Merged
Conversation
When `cloud` (or OS_CLOUD) is set, load that named entry from a clouds.yaml file and use its auth/TLS settings as the lowest-precedence defaults. Search order: $OS_CLIENT_CONFIG_FILE, ./clouds.yaml, ~/.config/openstack/clouds.yaml, /etc/openstack/clouds.yaml. Per-field precedence is explicit provider config > OS_* env > clouds.yaml. `verify: false` maps to insecure TLS; a single auth domain_name/id fans out to both user and project domain unless overridden. Uses gopkg.in/yaml.v3 (already in the module graph; promoted to a direct require) — no new external dependency. secure.yaml, cloud profiles, and clouds-public.yaml are not yet resolved. Unit-tested; build/gofmt/lint clean.
strval returned an explicitly-empty config string (e.g. a variable defaulting to "") as-is instead of consulting the env var, so pick() coalesced it straight to the clouds.yaml fallback — silently skipping the OS_* env layer and inverting the documented config > env > clouds.yaml precedence. Treat an empty config value as unset (matching terraform-provider-openstack's env-default behavior). Added unit tests for strval/pick precedence. Found by adversarial review.
PF9-pushkar
added a commit
that referenced
this pull request
Jul 14, 2026
feat(provider): clouds.yaml (cloud / OS_CLOUD) support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2 (Phase 1 follow-ups). When
cloud(orOS_CLOUD) is set, auth defaults are sourced from aclouds.yamlentry.$OS_CLIENT_CONFIG_FILE,./clouds.yaml,~/.config/openstack/clouds.yaml,/etc/openstack/clouds.yaml.OS_*env >clouds.yaml.verify: false→ insecure TLS; a single authdomain_name/domain_idfans out to both user and project domain unless a specific key overrides.gopkg.in/yaml.v3(already in the module graph — promoted to a direct require, no new external dependency).secure.yaml, cloud profiles, andclouds-public.yamlare not yet resolved.Tests: unit tests for the parser (
internal/clients/clouds_test.go) and for theconfig > env > clouds.yamlprecedence including the empty-config edge case (internal/provider/config_test.go).Adversarial review fix included: an explicitly-empty config value (e.g. a variable defaulting to
"") now correctly falls through to the env var instead of skipping straight to the clouds.yaml fallback — restoring the documented precedence and matching terraform-provider-openstack's env-default behavior.build / vet / gofmt / golangci-lint (0 issues) / unit tests all clean.