Skip to content

Commit

Permalink
feat: add utility to print list of supported resources (#112)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Nemerson <[email protected]>
  • Loading branch information
jaspervdj-luminal and Evan Nemerson authored May 30, 2023
1 parent 16ee0d1 commit e41d799
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/list_resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# List Resources

The AWS provider is very old, and unfortunately some libraries it uses were
changed in backwards incompatible ways. To avoid linking with this, instead of
providing an interface in code we provide a command which generates a list of
types.
28 changes: 28 additions & 0 deletions cmd/list_resources/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"encoding/json"
"os"

"github.com/hashicorp/terraform-provider-aws/internal/provider"
)

type TypesList struct {
Types []string
}

func main() {
pi := provider.Provider()

types := TypesList{}
for k := range pi.ResourcesMap {
types.Types = append(types.Types, k)
}

data, err := json.MarshalIndent(types, "", " ")
if err != nil {
panic(err)
}

os.Stdout.Write(data)
}

0 comments on commit e41d799

Please sign in to comment.