From 8bbeb671dc22640b3eb08069b476780b40d07bd7 Mon Sep 17 00:00:00 2001 From: Ming Fang Date: Tue, 11 Aug 2020 21:37:03 -0400 Subject: [PATCH] generate Terraform Registry compatible docs --- cmd/generator/generator.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/generator/generator.go b/cmd/generator/generator.go index f2118e7..c4ebf18 100644 --- a/cmd/generator/generator.go +++ b/cmd/generator/generator.go @@ -43,7 +43,7 @@ func main() { } func generateSite() { - var baseDir = "./site" + var baseDir = "./docs/resources" CreateDirIfNotExist(baseDir) resourcesMap := k8s.BuildResourcesMap() @@ -56,13 +56,10 @@ func generateSite() { resource := resourcesMap[resourceKey] schema := k8s.K8SConfig_Singleton().TFSchemasMap[resourceKey] - dir := baseDir + "/" + resourceKey if k8s.IsDeprecated(schema) { - os.Remove(dir) - dir = baseDir + "/DEPRECATED/" + resourceKey + continue } - CreateDirIfNotExist(dir) - file, err := os.OpenFile(dir+"/"+"README.md", os.O_WRONLY|os.O_CREATE, 0755) + file, err := os.OpenFile(baseDir + "/" + resourceKey[4:] + ".md", os.O_WRONLY|os.O_CREATE, 0755) if err != nil { log.Fatal(err) }