@@ -49,6 +49,8 @@ func (g *ServiceGenerator) InitResources() error {
4949 return g .createPolicyResources ()
5050 case "generic_secret" :
5151 return g .createGenericSecretResources ()
52+ case "mount" :
53+ return g .createMountResources ()
5254 default :
5355 return errors .New ("unsupported service type. shouldn't ever reach here" )
5456 }
@@ -112,33 +114,14 @@ func (g *ServiceGenerator) mountsByType() ([]string, error) {
112114 }
113115 var typeMounts []string
114116 for name , mount := range mounts {
115- if mount .Type != g .mountType {
116- continue
117- }
118- id := strings .ReplaceAll (name , "/" , "" )
119- if g .filterAllow (fmt .Sprintf ("%s_secret_backend" , mount .Type ), id ) {
117+ if g .mountType == "" || mount .Type == g .mountType {
118+ id := strings .ReplaceAll (name , "/" , "" )
120119 typeMounts = append (typeMounts , id )
121120 }
122121 }
123122 return typeMounts , nil
124123}
125124
126- func (g * ServiceGenerator ) filterAllow (serviceName , id string ) bool {
127- add := true
128- for _ , filter := range g .Filter {
129- if filter .FieldPath == "id" &&
130- filter .IsApplicable (serviceName ) {
131- for _ , value := range filter .AcceptableValues {
132- add = value == id
133- if add {
134- break
135- }
136- }
137- }
138- }
139- return add
140- }
141-
142125func (g * ServiceGenerator ) createAuthBackendResources () error {
143126 backends , err := g .backendsByType ()
144127 if err != nil {
@@ -201,9 +184,7 @@ func (g *ServiceGenerator) backendsByType() ([]string, error) {
201184 continue
202185 }
203186 id := strings .ReplaceAll (name , "/" , "" )
204- if g .filterAllow (fmt .Sprintf ("%s_auth_backend" , authBackend .Type ), id ) {
205- typeBackends = append (typeBackends , id )
206- }
187+ typeBackends = append (typeBackends , id )
207188 }
208189 return typeBackends , nil
209190}
@@ -259,6 +240,23 @@ func (g *ServiceGenerator) createGenericSecretResources() error {
259240 return nil
260241}
261242
243+ func (g * ServiceGenerator ) createMountResources () error {
244+ mounts , err := g .mountsByType ()
245+ if err != nil {
246+ return err
247+ }
248+ for _ , mount := range mounts {
249+ g .Resources = append (g .Resources ,
250+ terraformutils .NewSimpleResource (
251+ mount ,
252+ mount ,
253+ "vault_mount" ,
254+ g .ProviderName ,
255+ []string {}))
256+ }
257+ return nil
258+ }
259+
262260func (g * ServiceGenerator ) PostConvertHook () error {
263261 for _ , resource := range g .Resources {
264262 switch resource .InstanceInfo .Type {
0 commit comments