github.com/wikibal01/hashicorp-terraform@v0.11.12-beta1/backend/legacy/legacy.go (about) 1 // Package legacy contains a backend implementation that can be used 2 // with the legacy remote state clients. 3 package legacy 4 5 import ( 6 "github.com/hashicorp/terraform/backend" 7 "github.com/hashicorp/terraform/state/remote" 8 ) 9 10 // Init updates the backend/init package map of initializers to support 11 // all the remote state types. 12 // 13 // If a type is already in the map, it will not be added. This will allow 14 // us to slowly convert the legacy types to first-class backends. 15 func Init(m map[string]backend.InitFn) { 16 for k := range remote.BuiltinClients { 17 if _, ok := m[k]; !ok { 18 // Copy the "k" value since the variable "k" is reused for 19 // each key (address doesn't change). 20 typ := k 21 22 // Build the factory function to return a backend of typ 23 m[k] = func() backend.Backend { 24 return &Backend{Type: typ} 25 } 26 } 27 } 28 }