Repository navigation
feat(create): expose AWS config as CLI flags; drop required aws.yaml - #926
Merged
Merged
Conversation
Mirrors the Hetzner pass (#918) for AWS so the provider works with no .onctl YAML. - setDefaults() (cmd/common.go): viper.SetDefault for aws.location (eu-central-1), aws.vm.type (t2.micro), aws.vm.username (ubuntu), matching the deleted aws.yaml. aws.vm.image is left undefaulted; provideraws.GetImages already falls back to the Ubuntu AMI name pattern when it's empty. - Bind the existing generic --type/--location/--username/--image create flags to aws.vm.type/aws.location/aws.vm.username/aws.vm.image too, the same way --username already drives both hetzner.vm.username and fc.vm.username. - Relax the --image guard in createCmd.Run to allow aws in addition to hetzner (opt.Vm.Image itself stays Hetzner-only/snapshot-ID specific; AWS reads the image purely through the aws.vm.image viper key). - Remove embedded internal/files/init/aws.yaml (onctl init no longer scaffolds it). - cmd/root.go initState(): aws joins hetzner/fc in the providers for which a missing/unreadable .onctl is non-fatal. - Extend flags_defaults_test.go with aws.* cases. Restructured the shared-flag assertions into a defaults-check pass followed by an override pass: once a flag bound to multiple provider keys is Set (even back to its own value), viper's flag layer outranks SetDefault for every key bound to it, so checking defaults and overrides in the same loop iteration broke later per-provider defaults sharing that flag.
4 tasks done
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3daff62eb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #926 +/- ##
==========================================
+ Coverage 22.76% 22.98% +0.22%
==========================================
Files 42 42
Lines 4182 4194 +12
==========================================
+ Hits 952 964 +12
- Misses 3114 3115 +1
+ Partials 116 115 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4 tasks done
…ile image for AWS ReadConfig was returning before reading onctl.yaml whenever the now-optional provider-specific YAML was missing, silently dropping shared settings (ssh keys, cloud-init timeout) for hetzner/fc/aws. Reorder so the general config always loads first. Also copy opt.Vm.Image into the aws.vm.image viper key after MergeConfig, since provideraws.GetImages only reads that key and previously ignored vm.image set via --file config (the --image flag already bound to it). Addresses Codex review feedback on PR #926. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5Rqe638fXqErzeUoMJcfe
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.
Summary
aws.location/aws.vm.type/aws.vm.usernamenow have built-in defaults (matching the deletedaws.yaml), and the existing generic--type/--location/--username/--imagecreate flags are bound to the AWS viper keys too.--imageis now accepted forawsas well ashetzner(AWS reads it purely via theaws.vm.imageviper key, notopt.Vm.Image, which stays Hetzner-only/snapshot-ID logic).internal/files/init/aws.yaml;onctl initno longer scaffolds it, and a missing.onctlis no longer fatal foraws.onctl init/YAML anymore.Test plan
go build ./...,go vet ./...,gofmt -l .cleango test ./...passes (full suite)cmd/flags_defaults_test.gowith AWS cases; restructured the shared-flag assertions into a defaults-check pass then an override pass (documented why in the test comment)