File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import * as aws from "@pulumi/aws";
16
16
import * as pulumi from "@pulumi/pulumi" ;
17
17
import { ResourceOptions } from "@pulumi/pulumi" ;
18
18
import * as schema from "../schema-types" ;
19
- import { getRegion , getRegionFromOpts , parseArn } from "../utils" ;
19
+ import { parseArn } from "../utils" ;
20
20
21
21
export interface BucketId {
22
22
name : pulumi . Output < string > ;
Original file line number Diff line number Diff line change @@ -82,15 +82,14 @@ export function getRegionFromOpts(opts: pulumi.CustomResourceOptions): pulumi.Ou
82
82
83
83
/** @internal */
84
84
export function getRegion ( res : pulumi . Resource ) : pulumi . Output < aws . Region > {
85
- // A little strange, but all we're doing is passing a fake type-token simply to get
86
- // the AWS provider from this resource.
87
- const provider = res . getProvider ? res . getProvider ( "aws::" ) : undefined ;
88
- return getRegionFromProvider ( provider ) ;
85
+ // uses the provider from the parent resource to fetch the region
86
+ return aws . getRegionOutput ( { } , { parent : res } ) . apply ( ( region ) => region . name as aws . Region ) ;
89
87
}
90
88
91
- function getRegionFromProvider ( provider : pulumi . ProviderResource | undefined ) {
92
- const region = provider ? ( < any > provider ) . region : undefined ;
93
- return region || aws . config . region ;
89
+ function getRegionFromProvider (
90
+ provider : pulumi . ProviderResource | undefined ,
91
+ ) : pulumi . Output < aws . Region > {
92
+ return aws . getRegionOutput ( { } , { provider } ) . apply ( ( region ) => region . name as aws . Region ) ;
94
93
}
95
94
96
95
/**
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package examples
18
18
19
19
import (
20
20
"fmt"
21
+ "os"
21
22
"path/filepath"
22
23
"testing"
23
24
"time"
@@ -46,6 +47,23 @@ func TestAccEcsCapacityProviderService(t *testing.T) {
46
47
integration .ProgramTest (t , & test )
47
48
}
48
49
50
+ func TestRegress1112 (t * testing.T ) {
51
+ t .Setenv ("AWS_REGION" , "" )
52
+ os .Unsetenv ("AWS_REGION" )
53
+ test := integration.ProgramTestOptions {
54
+ Quick : true ,
55
+ SkipRefresh : true ,
56
+ }.With (integration.ProgramTestOptions {
57
+ Dependencies : []string {
58
+ "@pulumi/awsx" ,
59
+ },
60
+ NoParallel : true , // cannot use call t.Parallel after t.Setenv
61
+ RunUpdateTest : false ,
62
+ Dir : filepath .Join (getCwd (t ), "ecs" , "nodejs" ),
63
+ })
64
+ integration .ProgramTest (t , & test )
65
+ }
66
+
49
67
func TestLbSimple (t * testing.T ) {
50
68
test := getNodeJSBaseOptions (t ).
51
69
With (integration.ProgramTestOptions {
You can’t perform that action at this time.
0 commit comments