Skip to content

Commit c6bcd3e

Browse files
committed
fix: don't early return in provider.Configure()
1 parent d60f938 commit c6bcd3e

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

pkg/provider/pulumi/aws/aws.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ func (a *awsProvider) Validate() error {
176176
}
177177

178178
func (a *awsProvider) Configure(ctx context.Context, autoStack *auto.Stack) error {
179-
if a.sc.Region != "" && autoStack != nil {
180-
return autoStack.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: a.sc.Region})
181-
}
182-
183179
dc, dok := a.sc.Config["default"]
184180

185181
for fn, f := range a.proj.Functions {
@@ -210,6 +206,10 @@ func (a *awsProvider) Configure(ctx context.Context, autoStack *auto.Stack) erro
210206
a.proj.Functions[fn] = f
211207
}
212208

209+
if a.sc.Region != "" && autoStack != nil {
210+
return autoStack.SetConfig(ctx, "aws:region", auto.ConfigValue{Value: a.sc.Region})
211+
}
212+
213213
return nil
214214
}
215215

pkg/provider/pulumi/azure/azure.go

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -202,27 +202,6 @@ func (a *azureProvider) Validate() error {
202202
}
203203

204204
func (a *azureProvider) Configure(ctx context.Context, autoStack *auto.Stack) error {
205-
if a.sc.Region != "" {
206-
err := autoStack.SetConfig(ctx, "azure:location", auto.ConfigValue{Value: a.sc.Region})
207-
if err != nil {
208-
return err
209-
}
210-
211-
err = autoStack.SetConfig(ctx, "azure-native:location", auto.ConfigValue{Value: a.sc.Region})
212-
if err != nil {
213-
return err
214-
}
215-
216-
return nil
217-
}
218-
219-
region, err := autoStack.GetConfig(ctx, "azure-native:location")
220-
if err != nil {
221-
return err
222-
}
223-
224-
a.sc.Region = region.Value
225-
226205
dc, dok := a.sc.Config["default"]
227206

228207
for fn, f := range a.proj.Functions {
@@ -253,7 +232,12 @@ func (a *azureProvider) Configure(ctx context.Context, autoStack *auto.Stack) er
253232
a.proj.Functions[fn] = f
254233
}
255234

256-
return nil
235+
err := autoStack.SetConfig(ctx, "azure:location", auto.ConfigValue{Value: a.sc.Region})
236+
if err != nil {
237+
return err
238+
}
239+
240+
return autoStack.SetConfig(ctx, "azure-native:location", auto.ConfigValue{Value: a.sc.Region})
257241
}
258242

259243
func (a *azureProvider) Deploy(ctx *pulumi.Context) error {

0 commit comments

Comments
 (0)