Terraform Onboarding
Resilience Testing with Terraform
This guide walks you through integrating Resilience Testing into your infrastructure using the Harness Terraform provider. After setting up, you can easily design, schedule, and monitor chaos experiments through Harness Dashboard, ensuring your systems are resilient and production-ready.
Overview
Harness simplifies chaos engineering with Terraform integration that enables you to:
Do Chaos Engineering across your environments - Automate the setup of chaos environments and infrastructures. Go to Infrastructure documentation to set up chaos environments.
Discover Services - Automatically detect services for chaos experiments. See Service Discovery documentation.
Setup custom Image Registry - Configure custom image registries for Harness Chaos Engineering workloads. See Image Registry documentation.
Enforce Security - Implement granular access controls and governance policies via Chaos Guard. See Chaos Guard documentation.
Prerequisites
Terraform Setup: For general Terraform installation and configuration, see the official Terraform documentation
Harness Provider: For Harness-specific provider setup, refer to the Platform Terraform documentation
Service Discovery: Service Discovery should be considered for enabling chaos engineering. For detailed information on setting up service discovery, refer to the Platform Service Discovery documentation
Infrastructure Provisioning
Use these Terraform resources to set up your chaos engineering infrastructure:
Common Configuration
First, define the common locals block that will be used across all resources:
Chaos Infrastructure
Enable Chaos Engineering on existing Harness infrastructures or provision new ones.
Resource: harness_chaos_infrastructure_v2
Documentation: harness_chaos_infrastructure_v2
Service Discovery
Configure service discovery to automatically detect services for chaos experiments.
Resource: harness_service_discovery_agent
Documentation: service_discovery_agent
Image Registry
Configure custom image registries for chaos experiments.
Resource: harness_chaos_image_registry
Documentation: harness_chaos_image_registry
Security Governance
Define security governance rules and conditions for chaos experiments to ensure safe execution in production environments.
Governance Conditions: Define time windows, environment restrictions, and other conditions
Resource: harness_chaos_security_governance_condition
Documentation: harness_chaos_security_governance_condition
Governance Rules: Apply conditions to specific environments and define actions (block, warn, etc.)
Resource: harness_chaos_security_governance_rule
Documentation: harness_chaos_security_governance_rule
After Infrastructure Setup
Once your infrastructure is provisioned:
Service Discovery: Your applications will be automatically discovered in the configured environments
Create Experiments: Use the Harness UI to manually create and configure your chaos experiments
Run Experiments: Execute experiments against your discovered services through the platform
Next Steps
Terraform Resources: Harness Terraform Provider Documentation
Platform Setup: Platform Terraform Documentation
Create Experiments: Start building your chaos experiments in the Harness UI after infrastructure deployment
Last updated
Was this helpful?