forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add utility to print list of supported resources (#112)
Co-authored-by: Evan Nemerson <[email protected]>
- Loading branch information
1 parent
16ee0d1
commit e41d799
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |