@@ -477,7 +477,6 @@ func TestTerraformAwsModulesVpcIntoTypeScript(t *testing.T) {
477
477
478
478
func TestS3BucketModSecret (t * testing.T ) {
479
479
// t.Parallel() - cannot use t.Parallel because the test uses SetEnv
480
-
481
480
localProviderBinPath := ensureCompiledProvider (t )
482
481
skipLocalRunsWithoutCreds (t )
483
482
testProgram := filepath .Join ("testdata" , "programs" , "ts" , "s3bucketmod" )
@@ -517,6 +516,35 @@ func TestS3BucketModSecret(t *testing.T) {
517
516
}
518
517
}
519
518
519
+ func TestShowingModifiedAWSCredentialsError (t * testing.T ) {
520
+ skipLocalRunsWithoutCreds (t )
521
+ localProviderBinPath := ensureCompiledProvider (t )
522
+
523
+ testProgram := filepath .Join ("testdata" , "programs" , "ts" , "s3bucketmod" )
524
+ localPath := opttest .LocalProviderPath ("terraform-module" , filepath .Dir (localProviderBinPath ))
525
+
526
+ // disable AWS credentials to test the error message shows up
527
+ integrationTest := newPulumiTest (t , testProgram , localPath ,
528
+ opttest .Env ("AWS_ACCESS_KEY_ID" , "" ),
529
+ opttest .Env ("AWS_SECRET_ACCESS_KEY" , "" ),
530
+ opttest .Env ("AWS_SESSION_TOKEN" , "" ),
531
+ opttest .Env ("AWS_REGION" , "" ))
532
+
533
+ // Get a prefix for resource names
534
+ prefix := generateTestResourcePrefix ()
535
+
536
+ // Set prefix via config
537
+ integrationTest .SetConfig (t , "prefix" , prefix )
538
+
539
+ // Generate package
540
+ //nolint:all
541
+ pulumiPackageAdd (t , integrationTest , localProviderBinPath , "terraform-aws-modules/s3-bucket/aws" , "4.5.0" , "bucket" )
542
+ _ , err := integrationTest .CurrentStack ().Up (context .Background ())
543
+ assert .Error (t , err )
544
+ // assert that error contains part of the modified credentials error message which is Pulumi sepcific
545
+ assert .ErrorContains (t , err , "Alternatively, you can use Pulumi ESC to set up dynamic credentials with AWS OIDC" )
546
+ }
547
+
520
548
// When writing out TF files, we need to replace data that is random with a static value
521
549
// so that the TF files are deterministic.
522
550
func cleanRandomDataFromTerraformArtifacts (t * testing.T , tfFilesDir string , replaces map [string ]string ) {
0 commit comments