gcloud beta terraform vet 是用于在基础架构 CI/CD 流水线中强制执行政策合规性的工具。运行此工具时,gcloud beta terraform vet 会使用准确验证方案所需的 Google CloudAPI 检索项目数据。您可以使用 gcloud beta terraform vet 检测违反政策的行为,并在部署到生产环境之前提供警告或停止部署。与 gcloud beta terraform vet 一起使用的一组限制条件也可以用于支持同一框架的任何其他工具。
使用 gcloud beta terraform vet,您可以:
在应用开发的任何阶段强制执行组织的政策
通过自动政策验证来移除手动错误
对所有政策管理使用单一范式,从而缩短学习时间
支持
在 gcloud beta terraform vet 正式发布 (GA) 之前,可能无法提供常规支持渠道。如需获取 gcloud beta terraform vet 支持,请在 terraform-google-conversion GitHub 代码库中提交工单。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003e\u003ccode\u003egcloud beta terraform vet\u003c/code\u003e is a tool designed to enforce policy compliance within infrastructure CI/CD pipelines, ensuring adherence to security and governance requirements.\u003c/p\u003e\n"],["\u003cp\u003eThe tool enables organizations to define constraints, representing the source of truth for security and governance, compatible across all application lifecycle stages.\u003c/p\u003e\n"],["\u003cp\u003eUsing \u003ccode\u003egcloud beta terraform vet\u003c/code\u003e automates policy validation, minimizes manual errors, and allows consistent policy management at any stage of development.\u003c/p\u003e\n"],["\u003cp\u003eWhile in its pre-GA phase, \u003ccode\u003egcloud beta terraform vet\u003c/code\u003e offers support via a designated GitHub repository, with further documentation available for guidance on creating and validating constraints.\u003c/p\u003e\n"],["\u003cp\u003ePre-GA products and features, like \u003ccode\u003egcloud beta terraform vet\u003c/code\u003e are available "as is" and are subject to the "Pre-GA Offerings Terms", meaning they might have limited support.\u003c/p\u003e\n"]]],[],null,["# Policy validation\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nBusinesses are shifting towards infrastructure-as-code, and with that change\ncomes a concern that configuration errors can cause security and governance\nviolations. To address this, security and cloud administrators need to be able\nto set up guardrails that make sure everyone in their organization follows\nsecurity best practices. These guardrails are in the form of *constraints*.\n\nConstraints define your organization's source of truth for security and\ngovernance requirements. The constraints must be compatible with tools across\nevery stage of the application lifecycle, from development, to deployment, and\neven to an audit of deployed resources.\n\n[`gcloud beta terraform vet`](/sdk/gcloud/reference/beta/terraform/vet) is a tool for\nenforcing policy compliance as part of an infrastructure CI/CD pipeline. When\nyou run this tool, `gcloud beta terraform vet` retrieves project data with Google Cloud\nAPIs that are necessary for accurate validation of your plan. You can use\n`gcloud beta terraform vet` to detect policy violations and provide warnings or halt\ndeployments before they reach production. The same set of constraints that you\nuse with `gcloud beta terraform vet` can also be used with any other tool that\nsupports the same framework.\n\nWith `gcloud beta terraform vet` you can:\n\n- Enforce your organization's policy at any stage of application development\n- Remove manual errors by automating policy validation\n- Reduce learning time by using a single paradigm for all policy management\n\nSupport\n-------\n\nUntil `gcloud beta terraform vet` is generally available (GA), regular support channels\nmight not be available. For support with `gcloud beta terraform vet`,\n[open a ticket](https://github.com/GoogleCloudPlatform/terraform-google-conversion/issues/new/choose)\non the `terraform-google-conversion` GitHub repository.\n\nDocumentation\n-------------\n\n`gcloud beta terraform vet` includes the following resources:\n\n- [Quickstart](/docs/terraform/policy-validation/quickstart) -- How to implement a constraint that throws an error, and then modify the constraint so the validation check passes.\n- [Create a policy library](/docs/terraform/policy-validation/create-policy-library) -- How to create a centralized policy repository.\n- [Create Terraform constraints](/docs/terraform/policy-validation/create-terraform-constraints) -- How to add Terraform-based constraints.\n- [Create CAI constraints](/docs/terraform/policy-validation/create-cai-constraints) -- How to add CAI-based constraints.\n- [Validate policies](/docs/terraform/policy-validation/validate-policies) -- How to validate policy compliance with `gcloud beta terraform vet`.\n- [Troubleshooting](/docs/terraform/policy-validation/troubleshooting) -- Potential problems and solutions to fix them.\n- [Migrate from terraform-validator](/docs/terraform/policy-validation/migrate-from-terraform-validator) - How to migrate to `gcloud beta terraform vet` from [terraform-validator](https://github.com/GoogleCloudPlatform/terraform-validator)."]]