MCPcopy Create free account
hub / github.com/auth0/auth0-cli / createImportFile

Function createImportFile

internal/cli/terraform.go:343–371  ·  view source on GitHub ↗
(outputDIR string, data importDataList)

Source from the content-addressed store, hash-verified

341}
342
343func createImportFile(outputDIR string, data importDataList) error {
344 filePath := path.Join(outputDIR, "auth0_import.tf")
345
346 file, err := os.Create(filePath)
347 if err != nil {
348 return err
349 }
350 defer func() {
351 _ = file.Close()
352 }()
353
354 fileContent := `# This file is automatically generated via the Auth0 CLI.
355# It can be safely removed after the successful generation
356# of Terraform resource definition files.
357{{range .}}
358import {
359 id = "{{ .ImportID }}"
360 to = {{ .ResourceName }}
361}
362{{end}}
363`
364
365 t, err := template.New("terraform").Parse(fileContent)
366 if err != nil {
367 return err
368 }
369
370 return t.Execute(file, data)
371}
372
373func generateTerraformResourceConfig(ctx context.Context, input *terraformInputs) error {
374 absoluteOutputPath, err := filepath.Abs(input.OutputDIR)

Callers 1

Calls 2

CloseMethod · 0.80
CreateMethod · 0.65

Tested by

no test coverage detected