A Python-based utility to automate the import of existing Jamf Pro resources into Terraform state files.
Managing Jamf Pro resources with Terraform enhances reproducibility, version control, and automation. However, importing existing Jamf Pro resources into Terraform can be tedious and error-prone. This tool simplifies the process by:
- Connecting to your Jamf Pro tenant via the Classic API.
- Fetching specified resources (e.g., scripts, policies, configuration profiles).
- Generating Terraform import blocks for each resource.
This facilitates a smoother transition to Infrastructure as Code (IaC) practices with Jamf Pro.
- Supports multiple Jamf Pro resource types.
- Generates Terraform import blocks compatible with Terraform v1.5 and above.
- Modular design for easy extension to additional resource types.
- Command-line interface for straightforward operation.
- Python 3.7 or higher
- Access to a Jamf Pro instance with appropriate API credentials
- Terraform v1.5 or higher
-
Clone the repository:
git clone https://github.com/deploymenttheory/jamftf-python-terraform-importer.git cd jamftf-python-terraform-importer
-
Install the required Python packages:
pip install -r requirements.txt
-
Configure your Jamf Pro API credentials and desired resources using environment variables or a JSON config file like
import_config.json
:{ "jamfpro_macos_configuration_profile_plist": true }
-
Run the importer script:
python main.py
This will generate Terraform import blocks for the selected resource types.
-
Use the generated import blocks to import resources into Terraform state:
terraform import <resource_type>.<resource_name> <resource_id>
- Scripts
- Policies
- Configuration Profiles
- Categories
- Computer Groups (Static and Smart)
- Advanced Computer Searches
- Computer Extension Attributes
Support for additional resource types can be added by extending the Resource
class and implementing the _get()
method.
Contributions are welcome! Please submit a pull request or open an issue to propose changes or enhancements.
This project is licensed under the MIT License. See the LICENSE file for details.
For more information and updates, visit the GitHub repository.