File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11package resource
22
33import (
4+ "context"
45 "errors"
56 "flag"
67 "fmt"
@@ -539,11 +540,6 @@ func Test(t TestT, c TestCase) {
539540 t .Fatal ("Acceptance tests must be run with the -v flag on tests" )
540541 }
541542
542- // Run the PreCheck if we have it
543- if c .PreCheck != nil {
544- c .PreCheck ()
545- }
546-
547543 // get instances of all providers, so we can use the individual
548544 // resources to shim the state during the tests.
549545 providers := make (map [string ]* schema.Provider )
@@ -558,6 +554,21 @@ func Test(t TestT, c TestCase) {
558554 providers [name ] = p
559555 }
560556
557+ // Auto-configure all providers.
558+ for _ , p := range providers {
559+ err = p .Configure (context .Background (), terraform .NewResourceConfigRaw (nil ))
560+ if err != nil {
561+ t .Fatal (err )
562+ }
563+ }
564+
565+ // Run the PreCheck if we have it.
566+ // This is done after the auto-configure to allow providers
567+ // to override the default auto-configure parameters.
568+ if c .PreCheck != nil {
569+ c .PreCheck ()
570+ }
571+
561572 if acctest .TestHelper == nil {
562573 t .Fatal ("Please configure the acctest binary driver" )
563574 }
You can’t perform that action at this time.
0 commit comments