From e41d79942f4881ffd033e983cfda28ebc48a7849 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 30 May 2023 14:39:44 +0200 Subject: [PATCH] feat: add utility to print list of supported resources (#112) Co-authored-by: Evan Nemerson --- cmd/list_resources/README.md | 6 ++++++ cmd/list_resources/main.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 cmd/list_resources/README.md create mode 100644 cmd/list_resources/main.go diff --git a/cmd/list_resources/README.md b/cmd/list_resources/README.md new file mode 100644 index 00000000000..11084ef699c --- /dev/null +++ b/cmd/list_resources/README.md @@ -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. diff --git a/cmd/list_resources/main.go b/cmd/list_resources/main.go new file mode 100644 index 00000000000..5a399b6ea3b --- /dev/null +++ b/cmd/list_resources/main.go @@ -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) +}