MCPcopy Index your code
hub / github.com/coder/coder / GetModuleFiles

Function GetModuleFiles

scaletest/dynamicparameters/template.go:52–88  ·  view source on GitHub ↗

GetModuleFiles returns a map of module files to be used with ExtraFiles

()

Source from the content-addressed store, hash-verified

50
51// GetModuleFiles returns a map of module files to be used with ExtraFiles
52func GetModuleFiles() map[string][]byte {
53 // Create the modules.json that Terraform needs to see the module
54 modulesJSON := struct {
55 Modules []struct {
56 Key string `json:"Key"`
57 Source string `json:"Source"`
58 Dir string `json:"Dir"`
59 } `json:"Modules"`
60 }{
61 Modules: []struct {
62 Key string `json:"Key"`
63 Source string `json:"Source"`
64 Dir string `json:"Dir"`
65 }{
66 {
67 Key: "",
68 Source: "",
69 Dir: ".",
70 },
71 {
72 Key: "two",
73 Source: "./modules/two",
74 Dir: "modules/two",
75 },
76 },
77 }
78
79 modulesJSONBytes, err := json.Marshal(modulesJSON)
80 if err != nil {
81 panic(err) // This should never happen with static data
82 }
83
84 return map[string][]byte{
85 "modules/two/main.tf": []byte(moduleTwoMainTF),
86 ".terraform/modules/modules.json": modulesJSONBytes,
87 }
88}
89
90func TemplateTarData() ([]byte, error) {
91 mainTF, err := TemplateContent()

Callers 2

TestRunFunction · 0.92
TemplateTarDataFunction · 0.85

Calls 1

MarshalMethod · 0.45

Tested by 1

TestRunFunction · 0.74