Quick Reference

Copy and paste these command snippets for common DR tasks:

shell
# 1. Create/select workspace and initialize with backend config
# Primary:
terraform workspace new primary || terraform workspace select primary
terraform init -backend-config=backend-configs/primary-oci.tfbackend
# Secondary:
terraform workspace new secondary || terraform workspace select secondary
terraform init -backend-config=backend-configs/secondary-oci.tfbackend

Why separate backend configs? Each workspace stores state independently. Using separate *.tfbackend files ensures that the primary and secondary states don't collide.

Daily Operations
shell
# Applies (run from the correct workspace)
terraform workspace select primary
terraform apply -var-file=primary-us-chicago-1.tfvars
terraform workspace select secondary
terraform apply -var-file=secondary-us-chicago-1.tfvars
# Manual failover (secondary)
kubectl --context oci-secondary -n logging scale deploy humio-operator --replicas=1
# Compare encryption key (hash) — primary vs secondary must match
kubectl get secret -n logging dr-primary-oci-storage-encryption --context oci-primary -o jsonpath='{.data.oci-storage-encryption-key}' | base64 -d | shasum -a 256
kubectl get secret -n logging dr-secondary-oci-storage-encryption --context oci-secondary -o jsonpath='{.data.oci-storage-encryption-key}' | base64 -d | shasum -a 256