(outputDIR string, data importDataList)
| 341 | } |
| 342 | |
| 343 | func 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 .}} |
| 358 | import { |
| 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 | |
| 373 | func generateTerraformResourceConfig(ctx context.Context, input *terraformInputs) error { |
| 374 | absoluteOutputPath, err := filepath.Abs(input.OutputDIR) |
no test coverage detected