Pulumi CrossGuard is a policy-as-code solution designed to validate infrastructure policies at deployment time, ensuring compliance with security and reliability best practices. It allows organizations to express policies as code using programming languages, which can prevent the creation of out-of-compliance resources. CrossGuard provides two main types of policies: ResourceValidationPolicy and StackValidationPolicy. ResourceValidationPolicy focuses on individual resources, preventing their creation or modification if they violate set policies, while StackValidationPolicy assesses the entire stack of resources after they have been created or modified, allowing for checks that require existing resource states. These policies are integrated into Pulumi's workflow, running during the pulumi preview and pulumi update commands to evaluate cloud resource definitions. The flexibility in writing these policies enables users to enforce rules either on a per-resource basis or across an entire stack, depending on their specific needs. Pulumi CrossGuard aims to enhance infrastructure management by catching potential issues early in the deployment process.