The Kubiya Projects service provides a comprehensive interface for managing infrastructure projects through template-based deployments.
It enables you to create, manage, and deploy projects using predefined templates with robust variable validation, planning workflows, and deployment automation.
# Plan and auto-approve if there are changesexecution = client.projects.plan( project_id=project_id, auto_approve=True)if execution.get('execution_id'): print("Deployment started automatically")else: print("No changes detected")
try: project = client.projects.create( name="incomplete-project", template_id="webapp-template", variables={ "app_name": "my-app" # Missing required variables like 'environment', 'database_url' } )except ProjectValidationError as e: print(f"Missing required variables: {e}") # Error will list all missing required variables # and show template help information
# List templates from specific repositorycustom_templates = client.projects.templates( repository="https://github.com/my-org/infrastructure-templates")for template in custom_templates: print(f"Custom template: {template['name']}")# Use template from custom repositoryproject = client.projects.create( name="custom-project", template_id="custom-template-id", variables={"environment": "staging"})
# Good practice: Use template validationtry: # Get template info first template = client.projects.template_info(template_id) print(f"Required variables: {[v['name'] for v in template['variables'] if v.get('required')]}") # Create with proper validation project = client.projects.create( name="validated-project", template_id=template_id, variables=complete_variables )except ProjectValidationError as e: print(f"Fix validation errors: {e}") return
# Set required environment variablesexport DATABASE_PASSWORD="secure-password"export API_SECRET_KEY="secret-api-key"export JWT_SECRET="jwt-signing-secret"
Copy
Ask AI
# Projects will automatically use environment variables for secretsproject = client.projects.create( name="secure-app", template_id="secure-template", variables={"app_name": "my-app"} # Secrets come from environment variables)