Add Validation Before Apply
Write useful Terraform variable validation that fails early with a clear error message.
Prevent a bastion module from accepting an admin CIDR that exposes access to the internet. Validate predictable misuse at the module boundary Relying on reviewers to notice every dangerous input makes safety depend on attention instead of the module contract. Name the contract admin_cidr must be a specific corporate, VPN, or break-glass range. It must not be the entire internet. The contract should be plain before it is code. If the team cannot state the rule, the validation will be arbitrary. Encode the predictable check Add validation that rejects 0.0.0.0/0 and empty values, and requires CIDR-like input. This catches the…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in