Created
May 18, 2021 08:47
-
-
Save nomaster/c70fdc2b823e41aa7e48f23b78296b5e to your computer and use it in GitHub Desktop.
Import Pingdom checks from API to Terraform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pingdomv3 | |
import subprocess | |
import os | |
pingdom_api_token = os.environ['PINGDOM_API_TOKEN'] | |
client = pingdomv3.Client(pingdom_api_token) | |
checks = client.get_checks(tags="environment_test") | |
for check in checks: | |
subprocess.call([ | |
"terraform", | |
"import", | |
f"pingdom_check.scope_server[\"{check['hostname']}\"]", | |
str(check['id']), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment