Skip to content

Commit 494115d

Browse files
committed
Fix availability zone
1 parent 11c6546 commit 494115d

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

hack/provider.yaml.tpl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,17 @@ options:
9494
password: false
9595
suggestions:
9696
- eu01
97-
- eu02
98-
default: ""
97+
default: "eu01"
98+
STACKIT_AVAILABILITY_ZONE:
99+
description: "The STACKIT availability zone to create the VM in. e.g. eu01"
100+
required: true
101+
password: false
102+
suggestions:
103+
- eu01-1
104+
- eu01-2
105+
- eu01-3
106+
- eu01-M
107+
default: "eu01-1"
99108
STACKIT_PRIVATE_KEY_PATH:
100109
description: "The location of the custom private key file"
101110
required: false

pkg/options/options.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ type Options struct {
99
MachineID string
1010
MachineFolder string
1111

12-
ClientOptions *ClientOptions
13-
ProjectID string
14-
Flavor string
15-
DiskSize string
12+
ClientOptions *ClientOptions
13+
ProjectID string
14+
AvailabilityZone string
15+
Flavor string
16+
DiskSize string
1617
}
1718

1819
type ClientOptions struct {
@@ -46,6 +47,10 @@ func FromEnv(skipMachine bool) (*Options, error) {
4647
if err != nil {
4748
return nil, err
4849
}
50+
retOptions.AvailabilityZone, err = fromEnvOrError("STACKIT_AVAILABILITY_ZONE")
51+
if err != nil {
52+
return nil, err
53+
}
4954
retOptions.DiskSize, err = fromEnvOrError("STACKIT_DISK_SIZE")
5055
if err != nil {
5156
return nil, err

pkg/stackit/stackit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (s *Stackit) Create(ctx context.Context, options *options.Options, publicKe
144144

145145
createServerPayload := iaas.CreateServerPayload{
146146
Name: &options.MachineID,
147-
AvailabilityZone: &options.ClientOptions.Region,
147+
AvailabilityZone: &options.AvailabilityZone,
148148
MachineType: &options.Flavor,
149149
BootVolume: &iaas.CreateServerPayloadBootVolume{
150150
DeleteOnTermination: utils.Ptr(true),

0 commit comments

Comments
 (0)