How do you test infrastructure code in CI (Terraform, Helm, Kubernetes manifests)?
IntermediateConceptTesting and Quality Gates
Answer
Layered checks: formatting and syntax (terraform fmt -check, terraform validate, helm lint), schema validation (kubeconform), policy as code (Conftest/OPA, Checkov, Kyverno CLI), security scanning (tfsec/trivy config), a terraform plan posted to the PR, and for important modules integration tests (Terratest or terraform test) in a sandbox account.
More on Testing and Quality Gates
What is the testing pyramid?BeginnerWhat is the difference between unit, integration, and end-to-end tests?BeginnerWhat are smoke tests and sanity tests in a deployment pipeline?IntermediateWhat is code coverage and is a high percentage a good target?IntermediateWhat is a quality gate in SonarQube?IntermediateHow do you integrate SonarQube into a CI pipeline and make it block on gate failure?Intermediate