Repository navigation
Commit 3daff62
committed
feat(create): expose AWS config as CLI flags; drop required aws.yaml
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.1 parent 0a15f82 commit 3daff62
5 files changed
Lines changed: 52 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
146 | 154 | | |
147 | 155 | | |
148 | 156 | | |
149 | | - | |
150 | | - | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | | - | |
61 | 71 | | |
62 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
63 | 76 | | |
64 | 77 | | |
65 | | - | |
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
73 | 91 | | |
74 | 92 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
| 106 | + | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
This file was deleted.
0 commit comments