Auto-sync: 2026-04-24 00:02

This commit is contained in:
2026-04-24 00:03:01 +08:00
parent bea2c71242
commit 4e9ee6f51e
74 changed files with 4235 additions and 152 deletions

View File

@@ -0,0 +1,103 @@
---
title: "Variables YAML"
type: concept
tags: [AWS, Tagging, Configuration, YAML, Automation]
last_updated: 2026-04-14
---
## Definition
`variables.yaml` 是 AWS Tag Validation Tool 的核心配置文件,采用 YAML 格式定义每个 AWS 账户所期望的合法标签键及其对应的允许值列表Allowed Values。该文件是标签验证工具进行合规性比对的数据来源每个账户可拥有独立的 `variables.yaml` 配置。
## Aliases
- variables.yml
- tag-variables.yaml
- account-vars.yaml
## File Structure
```yaml
# variables.yaml — 每个账户一份
account_id: "123456789012"
account_name: "sas-prod"
tags:
Environment:
required: true
allowed_values:
- dev
- staging
- prod
- uat
CostCenter:
required: true
allowed_values:
- CC-FINANCE
- CC-ENGINEERING
- CC-OPERATIONS
Owner:
required: true
allowed_values:
- team-platform
- team-data
- team-security
Application:
required: false
allowed_values: [] # any value accepted
Project:
required: true
allowed_values:
- project-alpha
- project-beta
- poc-ml-pipeline
```
## Core Attributes
| 属性 | 说明 |
|------|------|
| 文件格式 | YAML |
| 作用域 | Per-account每个账户独立配置 |
| 用途 | Tag Validation Tool 合规性比对的数据源 |
| 存储位置 | SRE Tools Repository |
| 管理方式 | 版本控制Git |
## Fields
| 字段 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `account_id` | string | 是 | AWS 账户 ID |
| `account_name` | string | 是 | 账户名称(便于识别) |
| `tags` | dict | 是 | 标签键→约束映射 |
| `required` | bool | 否 | 该标签是否为必填项 |
| `allowed_values` | list | 否 | 该标签的允许值集合;空列表表示任意值 |
## Context in This Wiki
在 AWS Tag Validation Tool 的工作流中,`variables.yaml` 扮演数据模型的角色:
```
variables.yaml 定义规范
Tag Validation Tool 读取配置
扫描 AWS 账户资源EC2/SG/LB/Lambda
比对实际标签值与 allowed_values
生成 CSV 报告Resource ID + 问题类型 + 期望值 vs 实际值)
```
## Related Concepts
- [[Tag-Validation-Tool]]:使用 variables.yaml 作为数据源的工具
- [[AWS-Tagging-Standards]]:标签规范的来源
- [[Service-Control-Policies-SCPs]]:与 variables.yaml 共同构成标签治理的"规则定义 + 强制 + 审计"三层体系
## Sources
- [[ctp-topic-28-aws-tag-validation-tool]]