A practical utility to bring existing ThousandEyes tests under Terraform management. It discovers tests via the v7 API, normalizes names, maps test types to Terraform resources, and emits one import block per test for clean, repeatable onboarding.
Why it matters
Eliminate config drift: migrate UI-created tests to code.
Fast onboarding: auto-generate import stanzas; no manual IDs.
Clean reviews: one test = one file for tidy diffs.
Future-proof: structured to add other resources later (alerts, labels).
What it does
Prompts you to pick an Account Group (AID).
Calls /v7/tests?aid=<AID>.
For each test:
extracts testId, testName, type
normalizes testName to a Terraform-safe identifier
maps type → Terraform resource (For example - page-load → thousandeyes_page_load)
Step 4 — Import and generate resource configuration
Use import blocks to both import and scaffold config:
terraform plan -generate-config-out=generated_imports.tf
Terraform fetches each referenced object and writes proposed resource blocks to generated_imports.tf.
Finalize the import:
terraform apply
You can then refactor the generated resources into your module as needed. After a successful import, the import files can be kept (repeatable onboarding) or removed.
Importing.Realword.to.Terraform.State.mp4
Troubleshooting (quick)
401 Unauthorized: In the Terraform provider, use the raw token (no “Bearer ”) and the correct AID. Verify by importing a single resource with -target=....
Missing files: Some items may be missing required fields (testId, testName, type) or need a new type mapping.
Name collisions: The tool auto-deduplicates (_1, _2, …).
Roadmap
Importers for alerts, tags, users and additional resource types.
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer: Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.